ITADN

Next.js Type error: Could not find a declaration file for module `@scalar/openapi-parser`

#133Closedhuypham50 创建于 2024-06-15
bug
H
huypham50commented
### What happens? ``` Type error: Could not find a declaration file for module '@scalar/openapi-parser'. '/Users/johndoe/Desktop/repo/node_modules/@scalar/openapi-parser/dist/src/index.js' implicitly has an 'any' type. Try `npm i --save-dev @types/scalar__openapi-parser` if it exists or add a new declaration (.d.ts) file containing `declare module '@scalar/openapi-parser';` > 1 | import { dereference } from "@scalar/openapi-parser"; ``` ### What did you expect to happen? Should have no type errors since package is written in Typescript (which is great!) ### How can we reproduce the issue? `yarn add @scalar/openapi-parser` `tsconfig.json` ``` { "compilerOptions": { "target": "esnext", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "baseUrl": ".", "plugins": [ { "name": "next" } ] }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "types.d.ts" ], "exclude": [ "node_modules" ], "ts-node": { "compilerOptions": { "module": "CommonJS" } } } ``` `next.config.js` ``` module.exports = { reactStrictMode: true, swcMinify: true, } ``` ### Swagger/OpenAPI Example _No response_
关闭于 2024-07-02 6 条评论