We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typesVersions
When using dtsRollup feature, I found that it is unable to bundle types from dependency while importing from root but works for sub-path modules.
dtsRollup
import { ClientDefinition } from 'kit/node'; export declare interface Foo extends ClientDefinition { bar: string; } export declare const foo: Foo; export { }
https://github.com/Timeless0911/api-extractor-issue-typeversions
pnpm install
pnpm build
Expected result:
ClientDefinition should be bundled
ClientDefinition
declare interface ClientDefinition { name: string; } export declare interface Foo extends ClientDefinition { bar: string; } export declare const foo: Foo; export { }
Actual result:
ClientDefinition are not be bundled
If I import ClientDefinition from kit instead of kit/node, it works well.
kit
kit/node
The package.json of kit is:
package.json
{ "name": "kit", "version": "1.0.0", "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./node": { "types": "./dist/node.d.ts", "default": "./dist/node.js" }, "./package.json": { "default": "./package.json" } }, "typesVersions": { "*": { "node": [ "./dist/node.d.ts" ] } }, "sideEffects": false }
The tsconfig of this repro demo is:
tsconfig
{ "compilerOptions": { "module": "commonjs", "moduleResolution": "node", }, "$schema": "https://json.schemastore.org/tsconfig", "include": ["src"] }
It seems api-extractor will take exports into consider, but will not read typeVersions field.
exports
typeVersions
If I change tsconfig.json to set as below, it will work as expected.
tsconfig.json
{ "compilerOptions": { "module": "NodeNext", "moduleResolution": "nodenext", }, "$schema": "https://json.schemastore.org/tsconfig", "include": ["src"] }
Also, if I change the import path as below, it will also work as expected.
- import { ClientDefinition } from "kit/node"; + import { ClientDefinition } from "kit";
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
node -v
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Summary
When using
dtsRollup
feature, I found that it is unable to bundle types from dependency while importing from root but works for sub-path modules.Repro steps
https://github.com/Timeless0911/api-extractor-issue-typeversions
pnpm install
pnpm build
Expected result:
ClientDefinition
should be bundledActual result:
ClientDefinition
are not be bundledDetails
If I import
ClientDefinition
fromkit
instead ofkit/node
, it works well.The
package.json
ofkit
is:The
tsconfig
of this repro demo is:It seems api-extractor will take
exports
into consider, but will not readtypeVersions
field.If I change
tsconfig.json
to set as below, it will work as expected.Also, if I change the import path as below, it will also work as expected.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: