@@ -103,6 +103,7 @@ import {
103103 NodeArray ,
104104 NodeBuilderFlags ,
105105 ParameterDeclaration ,
106+ parameterIsThisKeyword ,
106107 PrefixUnaryExpression ,
107108 PropertyDeclaration ,
108109 QuotePreference ,
@@ -437,24 +438,26 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
437438 return ;
438439 }
439440
440- for ( let i = 0 ; i < node . parameters . length && i < signature . parameters . length ; ++ i ) {
441- const param = node . parameters [ i ] ;
442- if ( ! isHintableDeclaration ( param ) ) {
443- continue ;
441+ let pos = 0 ;
442+ for ( const param of node . parameters ) {
443+ if ( isHintableDeclaration ( param ) ) {
444+ addParameterTypeHint ( param , parameterIsThisKeyword ( param ) ? signature . thisParameter : signature . parameters [ pos ] ) ;
444445 }
445-
446- const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode ( param ) ;
447- if ( effectiveTypeAnnotation ) {
446+ if ( parameterIsThisKeyword ( param ) ) {
448447 continue ;
449448 }
449+ pos ++ ;
450+ }
451+ }
450452
451- const typeHints = getParameterDeclarationTypeHints ( signature . parameters [ i ] ) ;
452- if ( ! typeHints ) {
453- continue ;
454- }
453+ function addParameterTypeHint ( node : ParameterDeclaration , symbol : Symbol | undefined ) {
454+ const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode ( node ) ;
455+ if ( effectiveTypeAnnotation || symbol === undefined ) return ;
455456
456- addTypeHints ( typeHints , param . questionToken ? param . questionToken . end : param . name . end ) ;
457- }
457+ const typeHints = getParameterDeclarationTypeHints ( symbol ) ;
458+ if ( typeHints === undefined ) return ;
459+
460+ addTypeHints ( typeHints , node . questionToken ? node . questionToken . end : node . name . end ) ;
458461 }
459462
460463 function getParameterDeclarationTypeHints ( symbol : Symbol ) {
0 commit comments