[@types/underscore] Support readonly tuples in object calls#46650
Conversation
…o a readonly tuple works with object type definitions.
|
@reubenrybnik Thank you for submitting this PR! This is a live comment which I will keep updated. Code ReviewsBecause you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 46650,
"author": "reubenrybnik",
"owners": [
"borisyankov",
"jbaldwin",
"ccurrens",
"confususs",
"jgonggrijp",
"ffflorian",
"regevbr",
"peterblazejewicz",
"reubenrybnik"
],
"dangerLevel": "ScopedAndTested",
"headCommitAbbrOid": "3653a84",
"headCommitOid": "3653a84e478198567e1cbffc9029ca020759e0b5",
"mergeIsRequested": true,
"stalenessInDays": 0,
"lastPushDate": "2020-08-10T05:45:42.000Z",
"lastCommentDate": "2020-08-11T20:39:30.000Z",
"maintainerBlessed": false,
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46650/files",
"hasMergeConflict": false,
"authorIsOwner": true,
"isFirstContribution": false,
"popularityLevel": "Popular",
"anyPackageIsNew": false,
"packages": [
"underscore"
],
"files": [
{
"path": "types/underscore/index.d.ts",
"kind": "definition",
"package": "underscore"
},
{
"path": "types/underscore/underscore-tests.ts",
"kind": "test",
"package": "underscore"
}
],
"hasDismissedReview": false,
"ciResult": "pass",
"lastReviewDate": "2020-08-11T20:02:32.000Z",
"reviewersWithStaleReviews": [],
"approvalFlags": 2,
"isChangesRequested": false
} |
|
🔔 @borisyankov @jbaldwin @ccurrens @confususs @jgonggrijp @ffflorian @regevbr @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select |
|
@reubenrybnik Everything looks good here. Great job! I am ready to merge this PR on your behalf. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@borisyankov, @jbaldwin, @ccurrens, @confususs, @jgonggrijp, @ffflorian, @regevbr, @peterblazejewicz: you can do this too.) |
|
Ready to merge |
|
I just published |
… tuples in object calls by @reubenrybnik
… tuples in object calls by @reubenrybnik
npm test.)npm run lint package-name(ortscif notslint.jsonis present).When installing the 1.10.20 type definitions, I ran across an issue with
objectthat I thought it would be nice to fix. By default TS typically infers the type of an array initialization as an array rather than a tuple even if it contains multiple types of objects, but TS3.4 and above supports anas constshorthand assertion that will turn any array-initializing declaration into a tuple without needing to manually specify all the types in the tuple (see below). However, the resulting tuple ends up being readonly, and type inference inPairValuedoesn't currently work with readonly tuples. This fixes that issue while still maintaining support for non-readonly tuples.