-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
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
Declaration files don't contain triple slash types directives #977
Comments
Workaround for egoist/tsup#977
We were able to workaround this by using // tsup.config.ts
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm"],
onSuccess: "yarn tsc -p tsconfig.tsup.json && echo 'Rebuilt'",
}); // tsconfig.tsup.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"include": ["src"],
"compilerOptions": {
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src"
}
} That also fixes #1050 |
Independent of tsup, beware of this change in TypeScript 5.5 regarding reference directives: https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/ You need to add |
@maxpatiiuk, it seems that tsup does not respect |
We are using tsup in storybook, but we seem to have a problem with the declaration files emitted by tsup.
This is a minimal reproduction of the file:
When I just try to generate type declaration with tsc, it will output this:
But when I do same with tsup, the triple slash types directive is missing:
Can I somehow configure
tsup
to generate those directives. It seems like this is meant to be included:https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-
This also breaks when building storybook in angular projects. When I manually add the directive it works again:
One workaround I found is setting the banner:
Upvote & Fund
The text was updated successfully, but these errors were encountered: