File tree 1 file changed +35
-3
lines changed
1 file changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -2049,6 +2049,31 @@ const printError = (diagnostic) => {
2049
2049
return items ;
2050
2050
} ;
2051
2051
2052
+ // TODO remove me when minimum supported typescript version will be 5.7
2053
+ const isArrayBufferLike = ( name ) => {
2054
+ if (
2055
+ [
2056
+ "Uint8Array" ,
2057
+ "Uint8ClampedArray" ,
2058
+ "Uint16Array" ,
2059
+ "Uint32Array" ,
2060
+ "Int8Array" ,
2061
+ "Int16Array" ,
2062
+ "Int32Array" ,
2063
+ "BigUint64Array" ,
2064
+ "BigInt64Array" ,
2065
+ "Float32Array" ,
2066
+ "Float64Array" ,
2067
+ "DataView" ,
2068
+ "Buffer" ,
2069
+ ] . includes ( name )
2070
+ ) {
2071
+ return true ;
2072
+ }
2073
+
2074
+ return false ;
2075
+ } ;
2076
+
2052
2077
/**
2053
2078
* @param {ts.Type } type the type
2054
2079
* @param {Set<ts.Type> } typeArgs type args specified in context
@@ -2152,13 +2177,20 @@ const printError = (diagnostic) => {
2152
2177
) } )[]`;
2153
2178
}
2154
2179
}
2180
+
2181
+ const symbol = type . getSymbol ( ) ;
2182
+ const typeArgumentsWithoutDefaults =
2183
+ symbol && isArrayBufferLike ( getFullEscapedName ( symbol ) )
2184
+ ? ""
2185
+ : `<${ parsed . typeArgumentsWithoutDefaults
2186
+ . map ( ( t ) => getCode ( t , typeArgs ) )
2187
+ . join ( ", " ) } >`;
2188
+
2155
2189
return `${ getCode (
2156
2190
parsed . target ,
2157
2191
typeArgs ,
2158
2192
"with type args" ,
2159
- ) } <${ parsed . typeArgumentsWithoutDefaults
2160
- . map ( ( t ) => getCode ( t , typeArgs ) )
2161
- . join ( ", " ) } >`;
2193
+ ) } ${ typeArgumentsWithoutDefaults } `;
2162
2194
}
2163
2195
case "interface" : {
2164
2196
const variable = typeToVariable . get ( type ) ;
You can’t perform that action at this time.
0 commit comments