Skip to content

TS 5.5.0-beta Regression: generated .d.ts is not compatible #58682

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

Closed
ericanderson opened this issue May 28, 2024 · 2 comments
Closed

TS 5.5.0-beta Regression: generated .d.ts is not compatible #58682

ericanderson opened this issue May 28, 2024 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ericanderson
Copy link
Contributor

🔎 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

@ericanderson ericanderson changed the title TS 5.5-beta Regression: generated .d.ts is not compatible TS 5.5.0-beta Regression: generated .d.ts is not compatible May 28, 2024
@fatcerberus
Copy link

fatcerberus commented May 28, 2024

This looks very similar to #58557 #58390

@dragomirtitian
Copy link
Contributor

This is fixed in the nightly Playground Link

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Fixed A PR has been merged for this issue labels May 30, 2024
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.5.1 milestone May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants