@@ -7365,7 +7365,7 @@ func (c *Checker) checkSuperExpression(node *ast.Node) *Type {
7365
7365
7366
7366
func (c *Checker) isInConstructorArgumentInitializer(node *ast.Node, constructorDecl *ast.Node) bool {
7367
7367
return ast.FindAncestorOrQuit(node, func(n *ast.Node) ast.FindAncestorResult {
7368
- if ast.IsFunctionLikeDeclaration(n) {
7368
+ if n != nil && ast.IsFunctionLikeDeclaration(n) {
7369
7369
return ast.FindAncestorQuit
7370
7370
}
7371
7371
if ast.IsParameter(n) && n.Parent == constructorDecl {
@@ -11128,7 +11128,7 @@ func (c *Checker) isNodeUsedDuringClassInitialization(node *ast.Node) bool {
11128
11128
return ast.FindAncestorOrQuit(node, func(element *ast.Node) ast.FindAncestorResult {
11129
11129
if ast.IsConstructorDeclaration(element) && ast.NodeIsPresent(element.Body()) || ast.IsPropertyDeclaration(element) {
11130
11130
return ast.FindAncestorTrue
11131
- } else if ast.IsClassLike(element) || ast.IsFunctionLikeDeclaration(element) {
11131
+ } else if ast.IsClassLike(element) || (element != nil && ast.IsFunctionLikeDeclaration(element) ) {
11132
11132
return ast.FindAncestorQuit
11133
11133
}
11134
11134
return ast.FindAncestorFalse
@@ -18582,7 +18582,7 @@ func (c *Checker) createGeneratorType(yieldType *Type, returnType *Type, nextTyp
18582
18582
18583
18583
func (c *Checker) reportErrorsFromWidening(declaration *ast.Node, t *Type, wideningKind WideningKind) {
18584
18584
if c.noImplicitAny && t.objectFlags&ObjectFlagsContainsWideningType != 0 {
18585
- if wideningKind == WideningKindNormal || ast.IsFunctionLikeDeclaration(declaration) && c.shouldReportErrorsFromWideningWithContextualSignature(declaration, wideningKind) {
18585
+ if wideningKind == WideningKindNormal || declaration != nil && ast.IsFunctionLikeDeclaration(declaration) && c.shouldReportErrorsFromWideningWithContextualSignature(declaration, wideningKind) {
18586
18586
// Report implicit any error within type if possible, otherwise report error on declaration
18587
18587
if !c.reportWideningErrorsInType(t) {
18588
18588
c.reportImplicitAny(declaration, t, wideningKind)
0 commit comments