Skip to content

Commit bb098d8

Browse files
committed
fix: addressed review comments
1 parent 1190b10 commit bb098d8

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

packages/type-compiler/src/compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ export class ReflectionTransformer implements CustomTransformer {
21812181
: isTypeReferenceNode(type)
21822182
? type.typeName
21832183
: (isIdentifier(type.expression) ? type.expression : undefined);
2184-
const typeArguments: readonly TypeNode[] | undefined = isTypeReferenceNode(type) || isExpressionWithTypeArguments(type) ? type.typeArguments : [];
2184+
const typeArguments: readonly TypeNode[] | undefined = isTypeReferenceNode(type) || isExpressionWithTypeArguments(type) ? type.typeArguments : undefined;
21852185

21862186
if (!typeName) {
21872187
program.pushOp(ReflectionOp.any);

packages/type-spec/src/type.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export enum TypeNumberBrand {
3535
float64,
3636
}
3737

38+
/**
39+
* Intrinsic string manipulation type operations.
40+
* These correspond to TypeScript's built-in string manipulation utility types.
41+
*/
3842
export enum TypeIntrinsic {
3943
Uppercase,
4044
Lowercase,

packages/type/src/reflection/processor.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,10 @@ export class Processor {
12071207
this.push(handleUncapitalize(type));
12081208
break;
12091209
}
1210+
default: {
1211+
this.push(type);
1212+
break;
1213+
}
12101214
}
12111215
break;
12121216
}
@@ -1797,6 +1801,7 @@ function handleUppercase(type: Type): Type {
17971801
if (type.kind !== ReflectionKind.literal || 'string' !== typeof type.literal) {
17981802
return { kind: ReflectionKind.string };
17991803
}
1804+
if (!type.literal) return type;
18001805
return { kind: ReflectionKind.literal, literal: type.literal.toUpperCase() };
18011806
}
18021807

@@ -1807,6 +1812,7 @@ function handleLowercase(type: Type): Type {
18071812
if (type.kind !== ReflectionKind.literal || 'string' !== typeof type.literal) {
18081813
return { kind: ReflectionKind.string };
18091814
}
1815+
if (!type.literal) return type;
18101816
return { kind: ReflectionKind.literal, literal: type.literal.toLowerCase() };
18111817
}
18121818

@@ -1817,6 +1823,7 @@ function handleCapitalize(type: Type): Type {
18171823
if (type.kind !== ReflectionKind.literal || 'string' !== typeof type.literal) {
18181824
return { kind: ReflectionKind.string };
18191825
}
1826+
if (!type.literal) return type;
18201827
return { kind: ReflectionKind.literal, literal: type.literal.charAt(0).toUpperCase() + type.literal.slice(1) };
18211828
}
18221829

@@ -1827,6 +1834,7 @@ function handleUncapitalize(type: Type): Type {
18271834
if (type.kind !== ReflectionKind.literal || 'string' !== typeof type.literal) {
18281835
return { kind: ReflectionKind.string };
18291836
}
1837+
if (!type.literal) return type;
18301838
return { kind: ReflectionKind.literal, literal: type.literal.charAt(0).toLowerCase() + type.literal.slice(1) };
18311839
}
18321840

packages/type/src/reflection/type.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,6 @@ export function stringifyType(type: Type, stateIn: Partial<StringifyTypeOptions>
25232523
break;
25242524
case ReflectionKind.templateLiteral:
25252525
stack.push({ before: '`' });
2526-
debugger;
25272526
for (let i = type.types.length - 1; i >= 0; i--) {
25282527
const sub = type.types[i];
25292528
if (sub.kind === ReflectionKind.literal) {

0 commit comments

Comments
 (0)