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

Question about change of type relations rules in regards to index signatures #4651

Closed
osdm opened this issue Sep 4, 2015 · 3 comments
Closed
Assignees
Labels
Spec Issues related to the TypeScript language specification

Comments

@osdm
Copy link

osdm commented Sep 4, 2015

From 1.6 spec, rules about subtypes/supertypes:

  • M is a string index signature of type U, and U is the Any type or S has an apparent string
    index signature of a type that is a subtype of U.
  • M is a numeric index signature of type U, and U is the Any type or S has an apparent
    string or numeric index signature of a type that is a subtype of U.

"U is the Any type or " was added here. But similar rules for assignability weren't changed. That is strange: until 1.6 assignability rules were more relaxed than subtyping rules. What is the rationale for that? Thanks!

@DanielRosenwasser DanielRosenwasser added the Question An issue which isn't directly actionable in code label Sep 4, 2015
@DanielRosenwasser
Copy link
Member

The original change was performed in PR #4074. Why this isn't part of assignability, I'm not sure, but maybe @ahejlsberg can answer.

@osdm
Copy link
Author

osdm commented Sep 4, 2015

Well, an example at #4074 deals with assignability, not subtyping. So I guess it's just an error in spec, and changes should be moved or copied to assignability.

@ahejlsberg
Copy link
Member

It's an error in the spec. The new wording should also be present in the section on assignability. Thanks for pointing it out.

@danquirk danquirk added Bug A bug in TypeScript Spec Issues related to the TypeScript language specification and removed Question An issue which isn't directly actionable in code labels Sep 4, 2015
@mhegazy mhegazy added this to the TypeScript 1.7 milestone Sep 5, 2015
@mhegazy mhegazy removed the Bug A bug in TypeScript label Sep 5, 2015
@mhegazy mhegazy modified the milestones: TypeScript 1.7, TypeScript 1.8 Oct 9, 2015
@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
Spec Issues related to the TypeScript language specification
Projects
None yet
Development

No branches or pull requests

5 participants