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

Non-null assertion operator should work on index signature #13146

Closed
tinganho opened this issue Dec 23, 2016 · 1 comment
Closed

Non-null assertion operator should work on index signature #13146

tinganho opened this issue Dec 23, 2016 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@tinganho
Copy link
Contributor

tinganho commented Dec 23, 2016

I think the following code should work:

interface A {
    [index: string]: string;
}
interface B {
    a: A;
}
let b: B = { } as any;
b.a.some!; // error? some

Because you have asserted it to be non-null and an index signature tells that A can contain more props than what is defined in A. It makes sense to let people assert non-null in those cases.

@gcnew
Copy link
Contributor

gcnew commented Dec 23, 2016

I think #12596 is what you are after.

@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 26, 2016
@mhegazy mhegazy closed this as completed Dec 26, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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