-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
tsc correctly raises TS errors - tsup builds and ignores errors #609
Comments
I need a repro to tell if this is a bug |
Got the exact same issue here, running with Running This is currently blocking me. |
I can reproduce it with this: // index.ts
import { bar } from "./bar"
export function foo() {
bar()
}
// bar.ts
export const bar = () => {}
export function unused_error_function() {
let a: string = 1 // <-- type error
return a
} Seems rollup-plugin-dts doesn't type check unused export @OmgImAlexis did you have the same code pattern? |
Hi 👋 I noticed this coming from functions that are missing import statements. Tsc would pick up the missing imports but tsup --dts wouldn't throw an error for any missing functions |
it seems that rollup-plugin-dts doesn't type check
Here are my thoughts: rollup-plugin-dts use typescript's api(
This has nothing to do with I'm not sure if it is a bug of rollup-plugin-dts, seems that the recommended way to use this plugin is with generated dts with tsc(Swatinem/rollup-plugin-dts#41 (comment)) ~ Can we use tsc generate declaration files and then use rollup-plugin-dts or api-extractor bundle dts files? this also should be no problem with type check :) |
Ran into the same problem, maybe the docs should mention that you can't rely on the --dts flag for type checking? |
I ran into the same problem :( I had to use
|
Any update on this please. |
I was debugging what is happening, and it seems that when rollup-plugin-dts calls typescript, typescript compiler correctly type-checks the files (since they are part of the ts.Program), but then those type errors are not reported by ts.Program.emit() To be more specific, as part of function getEmitResolver(sourceFile: SourceFile, cancellationToken: CancellationToken, skipDiagnostics?: boolean) {
// Ensure we have all the type information in place for this file so that all the
// emitter questions of this resolver will return the right information.
if (!skipDiagnostics) getDiagnostics(sourceFile, cancellationToken);
return emitResolver;
} (from Where |
It looks like type errors are correctly emitted if I am using TSUP's |
Could tsup possibly use |
If I run
pnpm exec tsc --noEmit
then I get 5 errors. If I runpnpm exec tsup src/index.ts --dts
then I 0 errors.I realize I don't provide enough info here but first I just want to ask if this isn't a bug?
Upvote & Fund
The text was updated successfully, but these errors were encountered: