File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 11# Unreleased
22
3+ ### Bug Fixes
4+
5+ - Fixed conversion of intrinsic string mapping types when converting without a type node, #2079 .
6+
37## v0.23.17 (2022-10-18)
48
59### Features
Original file line number Diff line number Diff line change @@ -644,7 +644,7 @@ const queryConverter: TypeConverter<ts.TypeQueryNode> = {
644644
645645const referenceConverter : TypeConverter <
646646 ts . TypeReferenceNode ,
647- ts . TypeReference
647+ ts . TypeReference | ts . StringMappingType
648648> = {
649649 kind : [ ts . SyntaxKind . TypeReference ] ,
650650 convert ( context , node ) {
@@ -688,9 +688,17 @@ const referenceConverter: TypeConverter<
688688 context . resolveAliasedSymbol ( symbol ) ,
689689 context
690690 ) ;
691- ref . typeArguments = (
692- type . aliasSymbol ? type . aliasTypeArguments : type . typeArguments
693- ) ?. map ( ( ref ) => convertType ( context , ref ) ) ;
691+ if ( type . flags & ts . TypeFlags . StringMapping ) {
692+ ref . typeArguments = [
693+ convertType ( context , ( type as ts . StringMappingType ) . type ) ,
694+ ] ;
695+ } else {
696+ ref . typeArguments = (
697+ type . aliasSymbol
698+ ? type . aliasTypeArguments
699+ : ( type as ts . TypeReference ) . typeArguments
700+ ) ?. map ( ( ref ) => convertType ( context , ref ) ) ;
701+ }
694702 return ref ;
695703 } ,
696704} ;
Original file line number Diff line number Diff line change 1+ export function capitalize < T extends string > ( string : T ) {
2+ return (
3+ string === "" ? "" : string [ 0 ] . toUpperCase ( ) + string . slice ( 1 )
4+ ) as Capitalize < T > ;
5+ }
Original file line number Diff line number Diff line change @@ -803,4 +803,10 @@ export const issueTests: {
803803 gh2064 ( project ) {
804804 query ( project , "PrivateCtorDecl.x" ) ;
805805 } ,
806+
807+ gh2079 ( project ) {
808+ const cap = query ( project , "capitalize" ) ;
809+ const sig = cap . signatures ! [ 0 ] ;
810+ equal ( sig . type ?. toString ( ) , "Capitalize<T>" ) ;
811+ } ,
806812} ;
You can’t perform that action at this time.
0 commit comments