@@ -315,13 +315,13 @@ function getInfo(sourceFile: SourceFile, tokenPos: number, errorCode: number, ch
315315 const param = signature . parameters [ argIndex ] . valueDeclaration ;
316316 if ( ! ( param && isParameter ( param ) && isIdentifier ( param . name ) ) ) return undefined ;
317317
318- const properties = arrayFrom ( checker . getUnmatchedProperties ( checker . getTypeAtLocation ( parent ) , checker . getParameterType ( signature , argIndex ) , /*requireOptionalProperties*/ false , /*matchDiscriminantProperties*/ false ) ) ;
318+ const properties = arrayFrom ( checker . getUnmatchedProperties ( checker . getTypeAtLocation ( parent ) , checker . getParameterType ( signature , argIndex ) . getNonNullableType ( ) , /*requireOptionalProperties*/ false , /*matchDiscriminantProperties*/ false ) ) ;
319319 if ( ! length ( properties ) ) return undefined ;
320320 return { kind : InfoKind . ObjectLiteral , token : param . name , identifier : param . name . text , properties, parentDeclaration : parent } ;
321321 }
322322
323323 if ( token . kind === SyntaxKind . OpenBraceToken && isObjectLiteralExpression ( parent ) ) {
324- const targetType = checker . getContextualType ( parent ) || checker . getTypeAtLocation ( parent ) ;
324+ const targetType = ( checker . getContextualType ( parent ) || checker . getTypeAtLocation ( parent ) ) ?. getNonNullableType ( ) ;
325325 const properties = arrayFrom ( checker . getUnmatchedProperties ( checker . getTypeAtLocation ( parent ) , targetType , /*requireOptionalProperties*/ false , /*matchDiscriminantProperties*/ false ) ) ;
326326 if ( ! length ( properties ) ) return undefined ;
327327
@@ -334,7 +334,7 @@ function getInfo(sourceFile: SourceFile, tokenPos: number, errorCode: number, ch
334334 if ( ! isMemberName ( token ) ) return undefined ;
335335
336336 if ( isIdentifier ( token ) && hasInitializer ( parent ) && parent . initializer && isObjectLiteralExpression ( parent . initializer ) ) {
337- const targetType = checker . getContextualType ( token ) || checker . getTypeAtLocation ( token ) ;
337+ const targetType = ( checker . getContextualType ( token ) || checker . getTypeAtLocation ( token ) ) ?. getNonNullableType ( ) ;
338338 const properties = arrayFrom ( checker . getUnmatchedProperties ( checker . getTypeAtLocation ( parent . initializer ) , targetType , /*requireOptionalProperties*/ false , /*matchDiscriminantProperties*/ false ) ) ;
339339 if ( ! length ( properties ) ) return undefined ;
340340
0 commit comments