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

dot style assignment not works with indexed object interface #12611

Closed
e-cloud opened this issue Dec 2, 2016 · 2 comments
Closed

dot style assignment not works with indexed object interface #12611

e-cloud opened this issue Dec 2, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@e-cloud
Copy link
Contributor

e-cloud commented Dec 2, 2016

TypeScript Version: 2.1.1

Code

interface Dictionary {
    [key: string]: any;
}

const plugins: Dictionary = {}

plugins.test = {}

const plugins2: {
    [key: string]: any;
} = {}

plugins2.test = {}

Expected behavior:
no error

Actual behavior:

Property 'test' does not exist on type 'Dictionary'.
any

See the playground example

IMHO, dot style assignment should infer the property name as string

I think it's related to #6041

@mhegazy
Copy link
Contributor

mhegazy commented Dec 2, 2016

Duplicate of #12596

@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 2, 2016
@e-cloud
Copy link
Contributor Author

e-cloud commented Feb 25, 2017

this has been fixed in v2.2

@e-cloud e-cloud closed this as completed Feb 25, 2017
@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

2 participants