Uh oh!
There was an error while loading. Please reload this page.
Make tuples have known length - #17765
Conversation
Aluan Haddad (aluanhaddad)
commented
Aug 13, 2017
Shouldn't the |
ZpdDG4gta (zpdDG4gta8XKpMCd)
commented
Aug 13, 2017
practically it doesn't have to be, consider: interface X { length: 0; } |
kiara (KiaraGrouwstra)
commented
Aug 14, 2017
It hadn't occurred to me; |
Claudia Meadows (dead-claudia)
commented
Aug 15, 2017
I'd probably add Note that for dumb reasons, |
tuple-array assignability blocked by microsoft#17765
fa530ff to
1f77317ComparestrictTuples flag giving tuples known lengthkiara (KiaraGrouwstra)
commented
Aug 19, 2017
Update: should be good now, ready for feedback. |
kiara (KiaraGrouwstra)
commented
Aug 20, 2017
Travis randomly complaining: |
Ika (ikatyang)
commented
Aug 20, 2017
Tests should be fixed by ivogabe/gulp-typescript#536. |
kiara (KiaraGrouwstra)
commented
Aug 24, 2017
Merged for retry, Travis seems good again. Thanks Ika (@ikatyang). |
Nathan Shively-Sanders (sandersn)
left a comment
There was a problem hiding this comment.
I like this change, but I'm going to try implementing tuple-freshness first to see if it works well too.
| if (strictTuples) { | ||
| const lengthSymbol = createSymbol(SymbolFlags.Property, "length" as __String); | ||
| lengthSymbol.type = getLiteralType(arity); | ||
| lengthSymbol.checkFlags = CheckFlags.Readonly; |
There was a problem hiding this comment.
I don't see how adding Readonly helps if the type is literally 2, because only 2 can be assigned to it. If the intent is future-proofing in case Readonly will someday propagate through assignments, I think that it's as likely to harm as it is to help.
There was a problem hiding this comment.
Yeah, fair enough. I had no special intentions in adding it. Feel free to adjust as you see fit! :)
Nathan Shively-Sanders (sandersn)
commented
Nov 7, 2017
Given that the total impact of this change is 3 good breaks (firebase, leaflet and highcharts), plus incorrect array syntax (9), I think that it is small enough to ship without a flag. |
Nathan Shively-Sanders (sandersn)
commented
Nov 8, 2017
We had one more meeting, and decided to ship this PR without a flag and without |
Nathan Shively-Sanders (sandersn)
commented
Nov 8, 2017
Thanks @tycho01! |
Mohamed Hegazy (mhegazy)
commented
Nov 8, 2017
Nathan Shively-Sanders (@sandersn) please add a note about this change in the breaking change section for TS 2.7. We need also some guidance for the firebase use case |
Shahar "Dawn" Or (mightyiam)
commented
Nov 9, 2017
Hooray! |
Igor Oleinikov (Igorbek)
commented
Nov 9, 2017
@tycho01 Nathan Shively-Sanders (@sandersn) you are the best! Thank you! Nathan Shively-Sanders (@sandersn) now this should unblock #5453, right? :) |
strictTuples flag giving tuples known lengthkiara (KiaraGrouwstra)
commented
Nov 9, 2017
Thanks for the merge! At this rate I may get the motivation to finish those last few PRs too. :) |
Michael De Abreu (michaeljota)
commented
Dec 24, 2017
This should be added to the January release notes roadmap. |
Nathan Shively-Sanders (sandersn)
commented
Jan 2, 2018
Michael De Abreu (@michaeljota) I added it to the roadmap. |
Add fixed
lengthfor tuples following Aleksey-Bykov's a suggestion in #13239.Fixes#6229, so
[number, number]would not match[number](length2wouldn't match1).I put this behind a
strictTuplesflag so people can also still use the old behavior.