英文:
"Could not find a declaration file for module '@handsontable/react'" even though "d.ts" file exists
问题
以下是您要翻译的内容:
"I'm starting a new project with vite+react+ts+swc
with below command following vite document.
npm create vite@latest -- --template react-swc-ts
And, I installed handsontable library with below command. (It also written in handsontable document.)
npm install --save handsontable @handsontable/react
However, When I try to use handsontable in my App.tsx
file, It occurs two typescript errors.
// App.tsx
import { HotTable } from '@handsontable/react';
import { registerAllModules } from 'handsontable/registry';
src/App.tsx:6:26 - error TS7016: Could not find a declaration file for module '@handsontable/react'. '../node_modules/@handsontable/react/es/react-handsontable.mjs' implicitly has an 'any' type.
There are types at '../node_modules/@handsontable/react/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@handsontable/react' library may need to update its package.json or typings.
src/App.tsx:7:36 - error TS7016: Could not find a declaration file for module 'handsontable/registry'. '../node_modules/handsontable/registry.mjs' implicitly has an 'any' type.
There are types at '../node_modules/handsontable/registry.d.ts', but this result could not be resolved when respecting package.json "exports". The 'handsontable' library may need to update its package.json or typings.
Here is my tsconfig.json
. (created by vite template)
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
And I think there is no problem with handsontable library because it has index.d.ts
normally."
英文:
I'm starting a new project with vite+react+ts+swc
with below command following vite document.
npm create vite@latest -- --template react-swc-ts
And, I installed handsontable library with below command. (It also written in handsontable document.)
npm install --save handsontable @handsontable/react
However, When I try to use handsontable in my App.tsx
file, It occurs two typescript errors.
// App.tsx
import { HotTable } from '@handsontable/react';
import { registerAllModules } from 'handsontable/registry';
src/App.tsx:6:26 - error TS7016: Could not find a declaration file for module '@handsontable/react'. '.../node_modules/@handsontable/react/es/react-handsontable.mjs' implicitly has an 'any' type.
There are types at '.../node_modules/@handsontable/react/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@handsontable/react' library may need to update its package.json or typings.
src/App.tsx:7:36 - error TS7016: Could not find a declaration file for module 'handsontable/registry'. '.../node_modules/handsontable/registry.mjs' implicitly has an 'any' type.
There are types at '.../node_modules/handsontable/registry.d.ts', but this result could not be resolved when respecting package.json "exports". The 'handsontable' library may need to update its package.json or typings.
Here is my tsconfig.json
. (created by vite template)
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
And I think there is no problem with handsontable library because it has index.d.ts
normally.
答案1
得分: 0
这是Handsontable库中的一个错误。
https://github.com/handsontable/handsontable/issues/10448
英文:
It was a bug in the Handsontable library.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论