Skip to content

Commit bef6025

Browse files
committed
fixing configuration for typescript 6 and es2023
1 parent 0c1b2c5 commit bef6025

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/slangPrinter.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function hasNodeIgnoreComment({ comments }: StrictAstNode): boolean {
2222
);
2323
}
2424

25-
function ignoreComments(path: AstPath<AstNode>): void {
25+
function ignoreComments(path: AstPath<StrictAstNode>): void {
2626
const node = path.node;
2727
// We ignore anything that is not an object
2828
if (node === null || typeof node !== 'object') return;
@@ -38,15 +38,17 @@ function ignoreComments(path: AstPath<AstNode>): void {
3838
break;
3939
// The key `comments` will contain every comment for this node.
4040
case 'comments':
41-
path.each((commentPath) => (commentPath.node.printed = true), key);
41+
if (node.comments !== undefined) {
42+
path.each((commentPath) => (commentPath.node.printed = true), key);
43+
}
4244
break;
4345
default:
4446
// If the value for that key is an Array or an Object we go deeper.
4547
const childNode = node[key];
4648
if (typeof childNode === 'object') {
4749
if (Array.isArray(childNode)) {
4850
path.each(ignoreComments, key);
49-
return;
51+
break;
5052
}
5153
path.call(ignoreComments, key);
5254
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"compilerOptions": {
33
"allowJs": true,
4+
"rootDir": "./src",
45
"outDir": "./dist/",
56
"noImplicitAny": true,
67
"strictPropertyInitialization": true,
78
"sourceMap": true,
8-
"target": "es6",
9+
"target": "es2023",
910
"module": "NodeNext",
1011
"moduleResolution": "NodeNext",
1112
"strict": true,

0 commit comments

Comments
 (0)