gpt4 book ai didi

Property 'isIP' does not exist on type 'typeof import("...@types/validator/index")'(类型‘typeof IMPORT(“...@Types/validator/index”)“上不存在属性”“isip”“)

转载 作者:bug小助手 更新时间:2023-10-24 18:38:43 24 4
gpt4 key购买 nike



I recently upgraded TypeScript to version 5.2.2 and modified my tsconfig.json file a bit (set module/moduleResolution to "nodenext") and am now getting this error, which didn't previously occur:

我最近将TypeScrip升级到版本5.2.2,并稍微修改了我的tsconfig.json文件(将模块/模块分辨率设置为“nodenext”),现在我收到了这个错误,这是以前没有发生过的:


error TS2339: Property 'isIP' does not exist on type 'typeof import(".../node_modules/@types/validator/index")'.

Here's the file:

以下是文件:


// ./src/valid.ts
import validator from "validator";

console.log(validator.isIP("12312"));

validator is npm intalled.

验证器已安装NPM。


My ts config:

我的TS配置:


// tsconfig.json
{
"extends": "../../tsconfig.json",
"exclude": [
"build",
"data",
"node_modules"
],
"include": [
"./src/**/*"
],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build"
}
}

// ../../tsconfig.json
{
"compilerOptions": {
"target": "es2022",
"lib": [
"es2022"
],
"types": [
"vitest/importMeta"
],
"module": "nodenext",
"moduleResolution": "nodenext",
"sourceMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"declaration": true,
"declarationMap": true,
"composite": true,
"noUncheckedIndexedAccess": true
}
}


Reproduced in this repository: https://github.com/olalonde/tsbug

在此存储库中转载:https://github.com/olalonde/tsbug


更多回答
优秀答案推荐
更多回答

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com