Generic readonly array of objects in function messes IntelliSense for optional props #46282
Labels
Bug
A bug in TypeScript
Domain: Completion Lists
The issue relates to showing completion lists in an editor
Effort: Difficult
Good luck.
Help Wanted
You can do this
Milestone
Bug Report
🔎 Search Terms
generic readonly array, readonly optional missing, function readonly, readonly array object optional...
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=4.5.0-beta#code/GYVwdgxgLglg9mABAMQDwBVEFMAeUtgAmAzogE5YCGhCANgJ6IDelAXImCALYBGWZAGkQ8A-O2JQyMMAHMAvgG0AugD4AFDnboh9dmqhaAlIgC8KxADc4MQsaYAoOffvI1CluwBMQuUuMB6f2FEGixiMAByKERiAAs4AHdEEAAHRGlEAEkwfFpaGGICQqA
💻 Code
🙁 Actual behavior
No IntelliSense for optional properties in a readonly array of objects.
🙂 Expected behavior
IntelliSense for optional properties in a readonly array of objects.
I want this for my custom <Form /> React component, where I have a
fields
props, being it aReadonlyArray<{id: string, props?: Props}>
, and I have another prop for the component, theonSubmit
function, that takes the id's const strings from thefields
props to call the server with the corresponding Form data. It works, but theprops
property vanishes after defining the id, and it has lots of possible properties, so IntelliSense is pretty important there.The text was updated successfully, but these errors were encountered: