Fixed wrong error being reported on required initialized parameters with isolatedDeclarations#60980
Conversation
…ith `isolatedDeclarations`
| return createAccessorTypeError(node.parent); | ||
| } | ||
| const addUndefined = resolver.requiresAddingImplicitUndefined(node, /*enclosingDeclaration*/ undefined); | ||
| const addUndefined = resolver.requiresAddingImplicitUndefined(node, findAncestor(node, isFunctionLikeDeclaration)); |
There was a problem hiding this comment.
this is a somewhat cheap way of fixing this issue, given the importance of the enclosingDeclaration for the correct result resolver.requiresAddingImplicitUndefined, I really wonder if it shouldn't be made a required parameter
There was a problem hiding this comment.
It's already required, it's just that it can be undefined, you just don't really want to pass in undefined unless via some goofy callback, the checker gave it undefined.
There was a problem hiding this comment.
But, maybe external users should be required to provide it.
| return createAccessorTypeError(node.parent); | ||
| } | ||
| const addUndefined = resolver.requiresAddingImplicitUndefined(node, /*enclosingDeclaration*/ undefined); | ||
| const addUndefined = resolver.requiresAddingImplicitUndefined(node, node.parent); |
There was a problem hiding this comment.
I was initially worried about this just because enclosingDeclaration is weird and should/shouldn't be certain kinds of nodes, but in this case, node.parent is a function declaration (or expression), so is a valid choice.
There was a problem hiding this comment.
(also, no other caller than this ever passes undefined into requiresAddingImplicitUndefined explicitly, so, that's of note)
…ith `isolatedDeclarations` (microsoft#60980)
fixes #60976
cc @dragomirtitian