-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
TypeScript Version: 2.8.3
Search Terms: TS6133 TS4023
Code
tsconfig.json
{
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"sourceMap": true,
"declaration": true,
"noUnusedLocals": true
}
}
src/a.ts
import { createNamed } from "./b";
export const Value = createNamed();src/b.ts
export interface Named {}
export function createNamed(): Named {
return {};
}Expected behavior:
Preferably that the compiler will know to add the import when emitting declarations (which I am aware is the root cause of the error in the first example).
If that's not possible, then the compiler should not trigger a warning for imported types that are used for declaration emission only.
Actual behavior:
The compiler reports an error when not importing types that get implicitly exported. When adding the import to satisfy that requirement, the compiler errors because of the noUnusedLocals option. Removing the unused local (the import) causes the first error, hence the reason I aptly labeled this a paradox.
Playground Link: This error requires the use of multiple files. Therefore I have attached screenshots and sources that can be used to reproduce the exact setup.

