-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
The npm package incorrectly uses
import type * as hast from "@types/hast";which causes TypeScript errors with "module": "nodenext". This should be
import type * as hast from "hast";Related:
- Error: Cannot import type declaration files. Consider importing '***' instead of '@types/***'. denoland/dnt#457
- How to properly add @types/<something>? denoland/deno#27257
Minimal reproduction
tsconfig.json
{
"compilerOptions": {
"module": "nodenext",
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "hastx",
}
}hello.tsx
const hello = <h1>Hello, world!</h1>;$ npm i hastx typescript
$ npx tsc
node_modules/hastx/script/html.d.ts:1:28 - error TS6137: Cannot import type declaration files. Consider importing 'hast' instead of '@types/hast'.
1 import type * as hast from "@types/hast";
~~~~~~~~~~~~~
node_modules/hastx/script/jsx-runtime.d.ts:1:28 - error TS6137: Cannot import type declaration files. Consider importing 'hast' instead of '@types/hast'.
1 import type * as hast from "@types/hast";
~~~~~~~~~~~~~
node_modules/hastx/script/svg.d.ts:1:28 - error TS6137: Cannot import type declaration files. Consider importing 'hast' instead of '@types/hast'.
1 import type * as hast from "@types/hast";
~~~~~~~~~~~~~
Found 3 errors in 3 files.
Errors Files
1 node_modules/hastx/script/html.d.ts:1
1 node_modules/hastx/script/jsx-runtime.d.ts:1
1 node_modules/hastx/script/svg.d.ts:1Metadata
Metadata
Assignees
Labels
No labels