Closed
Description
🔎 Search Terms
".d.ts", "typeof", "5.5-beta"
🕗 Version & Regression Information
This is a regression from prior versions. You need two packages to reproduce so you can repro here: https://github.com/ericanderson/ts55-beta-regression
Simply changing from 5.4 to 5.5-beta causes typeof
references to no longer produce proper/compatible .d.ts files.
⏯ Playground Link
https://github.com/ericanderson/ts55-beta-regression
💻 Code
dep/src/index.ts
:
interface Shape<T extends string> {
hmm: T
}
const _Holder = {
hmm: "foo"
} satisfies Shape<"foo">;
type _Holder = typeof _Holder;
export interface Holder extends _Holder { }
export const Holder = _Holder as Holder;
main/src/index.ts
:
import { Holder } from "dep";
Holder.hmm;
🙁 Actual behavior
src/index.ts:3:8 - error TS2339: Property 'hmm' does not exist on type 'Holder'.
3 Holder.hmm;
~~~
dep/lib/index.d.ts
declare const _Holder: typeof _Holder;
type _Holder = typeof _Holder;
export interface Holder extends _Holder {
}
export declare const Holder: Holder;
export {};
🙂 Expected behavior
No errors.
dep/lib/index.d.ts
:
declare const _Holder: {
hmm: "foo";
};
type _Holder = typeof _Holder;
export interface Holder extends _Holder {
}
export declare const Holder: Holder;
export {};
Additional information about the issue
In the repo directory, you can fully reproduce by running:
pnpm install
(to link the packages)
pnpm run test