@@ -1589,38 +1589,32 @@ export function inferRuntimeType(
15891589 case 'TSTypeReference' : {
15901590 const resolved = resolveTypeReference ( ctx , node , scope )
15911591 if ( resolved ) {
1592- // #13240
1593- // Special case for function type aliases to ensure correct runtime behavior
1594- // other type aliases still fallback to unknown as before
1595- if (
1596- resolved . type === 'TSTypeAliasDeclaration' &&
1597- resolved . typeAnnotation . type === 'TSFunctionType'
1598- ) {
1599- return [ 'Function' ]
1600- }
1592+ if ( resolved . type === 'TSTypeAliasDeclaration' ) {
1593+ // #13240
1594+ // Special case for function type aliases to ensure correct runtime behavior
1595+ // other type aliases still fallback to unknown as before
1596+ if ( resolved . typeAnnotation . type === 'TSFunctionType' ) {
1597+ return [ 'Function' ]
1598+ }
16011599
1602- if ( ! node . typeParameters ) {
1603- return inferRuntimeType (
1604- ctx ,
1605- resolved ,
1606- resolved . _ownerScope ,
1607- isKeyOf ,
1608- )
1609- } else if ( resolved . type === 'TSTypeAliasDeclaration' ) {
1610- const typeParams : Record < string , Node > = Object . create ( null )
1611- if ( resolved . typeParameters ) {
1612- resolved . typeParameters . params . forEach ( ( p , i ) => {
1613- typeParams ! [ p . name ] = node . typeParameters ! . params [ i ]
1614- } )
1600+ if ( node . typeParameters ) {
1601+ const typeParams : Record < string , Node > = Object . create ( null )
1602+ if ( resolved . typeParameters ) {
1603+ resolved . typeParameters . params . forEach ( ( p , i ) => {
1604+ typeParams ! [ p . name ] = node . typeParameters ! . params [ i ]
1605+ } )
1606+ }
1607+ return inferRuntimeType (
1608+ ctx ,
1609+ resolved . typeAnnotation ,
1610+ resolved . _ownerScope ,
1611+ isKeyOf ,
1612+ typeParams ,
1613+ )
16151614 }
1616- return inferRuntimeType (
1617- ctx ,
1618- resolved . typeAnnotation ,
1619- resolved . _ownerScope ,
1620- isKeyOf ,
1621- typeParams ,
1622- )
16231615 }
1616+
1617+ return inferRuntimeType ( ctx , resolved , resolved . _ownerScope , isKeyOf )
16241618 }
16251619 if ( node . typeName . type === 'Identifier' ) {
16261620 if ( typeParameters && typeParameters [ node . typeName . name ] ) {
0 commit comments