Skip to content

Commit 9ef686e

Browse files
authored
More TS 7 fixes (#1347)
1 parent 382d86c commit 9ef686e

4 files changed

Lines changed: 49 additions & 33 deletions

File tree

‎.changeset/hot-peaches-beam.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
---
4+
5+

‎packages/dtslint/src/lintCorsa.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ function normalizedCorsaTypeToString(
336336
}
337337
function visit(node: Node): Node {
338338
node = astModule.visitEachChild(node, visit);
339+
if (astModule.isLiteralTypeNode(node) && astModule.isStringLiteral(node.literal)) {
340+
return factoryModule.createLiteralTypeNode(
341+
factoryModule.createStringLiteral(node.literal.text, astModule.TokenFlags.None),
342+
);
343+
}
339344
if (astModule.isUnionTypeNode(node)) {
340345
const types = node.types
341346
.map((item) => [item, print(item)] as const)

‎packages/dtslint/test/fixtures/corsa/pass/test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ object; // $ExpectType { a: number; b: string; }
1313
declare const indexedObject: { [key: string]: unknown; b: string; a: number };
1414
indexedObject; // $ExpectType { [key: string]: unknown; a: number; b: string; }
1515

16+
declare const quotedUnion: "b" | "a";
17+
quotedUnion; // $ExpectType 'a' | 'b'
18+
19+
declare const quotedObject: { value: "x" };
20+
quotedObject; // $ExpectType { value: 'x' }
21+
1622
declare const overloaded: {
1723
(value: string): string;
1824
(value: number): number;

‎pnpm-lock.yaml‎

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)