Skip to content

#52836 breaks fragmented-store on DT #53382

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
sandersn opened this issue Mar 20, 2023 · 2 comments · Fixed by #53383
Closed

#52836 breaks fragmented-store on DT #53382

sandersn opened this issue Mar 20, 2023 · 2 comments · Fixed by #53383
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Recent Regression This is a new regression just found in the last major/minor version of TypeScript.

Comments

@sandersn
Copy link
Member

sandersn commented Mar 20, 2023

#52836 broke fragmented-store on Definitely Typed. Here's a repro that doesn't depend on React:

type StateHook<S> = () => [S, unknown];

type StoreUtils<Store extends { [K: string]: any }> = Omit<{
    [K in keyof Store as `use${Capitalize<string & K>}`]: StateHook<Store[K]>
}, 'useStore'> & {
  Provider: unknown,
  useStore: StateHook<Store>
};

declare function createStore<Store extends { [K: string]: any }>(store: Store): StoreUtils<Store>;

const { Provider, useUsername, useAge, useStore } = createStore({
  username: "Aral",
  age: 31
});
@sandersn sandersn added this to the TypeScript 5.1.0 milestone Mar 20, 2023
@sandersn sandersn added Bug A bug in TypeScript Recent Regression This is a new regression just found in the last major/minor version of TypeScript. labels Mar 20, 2023
@fatcerberus
Copy link

fragmented-store types

I have literally never heard this term ever

@sandersn
Copy link
Member Author

Sorry, it's the name of a package on Definitely Typed. Edited the OP for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Recent Regression This is a new regression just found in the last major/minor version of TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants