Declaration emit with `--noResolve` differs from tsc
Steps to reproduce
tsconfig.json:
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"moduleResolution": "nodenext",
"declaration": true,
}
}
test.ts:
import * as typescript from "typescript";
export default {
...typescript,
} as typeof typescript;
Run tsc --noCheck --noResolve / tsgo --noCheck --noResolve.
(The use of the typescript package is a placeholder. I tested with multiple other packages and the behavior was the same.)
Behavior with [email protected]
test.d.ts:
import * as typescript from "typescript";
declare const _default: typeof typescript;
export default _default;
Behavior with tsgo
test.d.ts:
declare const _default: any;
export default _default;
I am not sure we actually support --noCheck yet. --noCheck is somewhat of a lie, sometimes, and does need to make sure some parts of the checker have been run before emit. This is I think one such example.
Though, --noResolve does complicate it.
Maybe this is a case of "no node reuse"?
Another example:
import { WritableAtom } from 'jotai'
export function focusAtom() {
return null as unknown as WritableAtom<any, any, any>
}
tsc emit:
import { WritableAtom } from 'jotai';
export declare function focusAtom(): WritableAtom<any, any, any>;
tsgo emit:
export declare function focusAtom(): WritableAtom<any, any, any>;
Which then produces downstream errors because WritableAtom is undefined.
Do all of your examples involve as?
So far, yeah, that seems to be the trigger.