You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the bug's cause (compiler would not consider the declaration.questionMark, and would only report as optional the union types including null and/or undefined). This actually makes me wonder if we should treat all any as optional (aka - if the type is any, then it is optional any)?
Well - optional is a type attribute, not a parameter attribute. In the general sense, it denotes nullability (and in fact, TypeScript lets you put optional arguments in any place you want).
Activity
RomainMuller commentedon Sep 18, 2018
I found the bug's cause (compiler would not consider the
declaration.questionMark, and would only report as optional the union types includingnulland/orundefined). This actually makes me wonder if we should treat allanyasoptional(aka - if the type isany, then it isoptional any)?fix(jsii): Optional `any` represented as required
RomainMuller commentedon Sep 18, 2018
Well the PR #237 includes code to make
anyoptional everywhere it is found (because that is how TypeScript thinks of it).eladb commentedon Sep 18, 2018
But what happens if there’s an “any” argument in the middle of a signature? Optional arguments are only allowed at the end.
RomainMuller commentedon Sep 19, 2018
Well -
optionalis a type attribute, not aparameterattribute. In the general sense, it denotes nullability (and in fact, TypeScript lets you put optional arguments in any place you want).fix(jsii): Optional `any` represented as required (#237)
v0.7.6 (#239)
eladb commentedon Sep 20, 2018
rix0rrr commentedon Sep 21, 2018
Yes, there is (somewhat) of a difference between
x?: l2andx: l2 | undefinedRomainMuller commentedon Oct 26, 2018
That is in large parts because
jsiimodelsoptionalas a type attribute, and not as a parameter attribute...