Skip to content
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

Cant use object's number keys with selection method #21858

Closed
artaommahe opened this issue Feb 10, 2018 · 2 comments
Closed

Cant use object's number keys with selection method #21858

artaommahe opened this issue Feb 10, 2018 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@artaommahe
Copy link

artaommahe commented Feb 10, 2018

TypeScript Version: 2.7.1

Search Terms:

Code

class Store<T>
{
    public get<A extends keyof T, B extends keyof T[A]>(key1: A, key2: B): T[typeof key1][typeof key2]
    {
        return <any>void 0;
    }
}

export interface IUsersWordsLoadingState
{
    [ userId: number ]: { wordsets: { smth: boolean } };
}

let initialState: { loadingState: IUsersWordsLoadingState };
let store: Store<typeof initialState>;
store.get('loadingState', 0);
Argument of type '0' is not assignable to parameter of type 'never'.

Expected behavior:

  • can use number keys in objects with selection method

Actual behavior:

  • cant use number keys in objects with selection method

Playground Link:
https://stackblitz.com/edit/angular-uz9kxg?file=app%2Fapp.component.ts

@mhegazy
Copy link
Contributor

mhegazy commented Feb 12, 2018

Please see #13715

@mhegazy mhegazy added the Duplicate An existing issue was already created label Feb 12, 2018
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants