Skip to content

Commit 638c34f

Browse files
committed
chore: format code
1 parent 422bdb0 commit 638c34f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src/compiler/emitter.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,14 @@ import {
423423
WriteFileCallbackData,
424424
YieldExpression,
425425
} from "./_namespaces/ts.js";
426-
import { isTypeReferenceNode, TypeFlags, TypeChecker } from "./_namespaces/ts.js";
426+
import {
427+
isTypeReferenceNode,
428+
TypeChecker,
429+
TypeFlags,
430+
} from "./_namespaces/ts.js";
427431
import * as performance from "./_namespaces/ts.performance.js";
428432
const brackets = createBracketsMap();
429433

430-
431-
432434
/** @internal */
433435
export function isUniqueSymbolDeclaration(node: VariableDeclarationList, checker: TypeChecker): boolean {
434436
return node.declarations.some((decl: VariableDeclaration) => {
@@ -457,7 +459,7 @@ export function isUniqueSymbolDeclaration(node: VariableDeclarationList, checker
457459
export function isBuildInfoFile(file: string): boolean {
458460
return fileExtensionIs(file, Extension.TsBuildInfo);
459461
}
460-
462+
461463
/**
462464
* Iterates over the source files that are expected to have an emit output.
463465
*
@@ -3421,24 +3423,23 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
34213423
writeKeyword("await");
34223424
writeSpace();
34233425
writeKeyword("using");
3424-
} else {
3426+
}
3427+
else {
34253428
// Check if unique symbol and use const instead of var
34263429
const isUnique = typeChecker && isUniqueSymbolDeclaration(node, typeChecker);
3427-
const head =
3428-
isLet(node) ? "let" :
3430+
const head = isLet(node) ? "let" :
34293431
isVarConst(node) ? "const" :
34303432
isVarUsing(node) ? "using" :
34313433
isUnique ? "const" :
34323434
"var";
3433-
3435+
34343436
writeKeyword(head);
34353437
}
3436-
3437-
writeSpace();
3438+
3439+
writeSpace();
34383440
emitList(node, node.declarations, ListFormat.VariableDeclarationList);
34393441
}
34403442

3441-
34423443
function emitFunctionDeclaration(node: FunctionDeclaration) {
34433444
emitFunctionDeclarationOrExpression(node);
34443445
}

src/compiler/transformers/declarations.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ import {
141141
isStringLiteralLike,
142142
isTupleTypeNode,
143143
isTypeAliasDeclaration,
144-
isTypeReferenceNode,
145144
isTypeElement,
146145
isTypeLiteralNode,
147146
isTypeNode,
148147
isTypeParameterDeclaration,
149148
isTypeQueryNode,
149+
isTypeReferenceNode,
150150
isVarAwaitUsing,
151151
isVariableDeclaration,
152152
isVarUsing,
@@ -219,10 +219,9 @@ import {
219219
VisitResult,
220220
} from "../_namespaces/ts.js";
221221

222-
223222
function isUniqueSymbolByType(type: TypeNode | undefined): boolean {
224223
if (!type) return false;
225-
224+
226225
if (type.kind === SyntaxKind.TypeOperator && (type as any).operator === SyntaxKind.UniqueKeyword) return true;
227226

228227
if (isTypeReferenceNode(type) && isIdentifier(type.typeName)) {
@@ -1497,11 +1496,13 @@ export function transformDeclarations(context: TransformationContext): Transform
14971496

14981497
const declList = factory.createVariableDeclarationList(
14991498
[varDecl],
1500-
shouldForceConst ? NodeFlags.Const : NodeFlags.None
1499+
shouldForceConst ? NodeFlags.Const : NodeFlags.None,
15011500
);
1502-
1501+
15031502
return factory.createVariableStatement(
1504-
isNonContextualKeywordName ? undefined : [factory.createToken(SyntaxKind.ExportKeyword)],declList);
1503+
isNonContextualKeywordName ? undefined : [factory.createToken(SyntaxKind.ExportKeyword)],
1504+
declList,
1505+
);
15051506
});
15061507
if (!exportMappings.length) {
15071508
declarations = mapDefined(declarations, declaration => factory.replaceModifiers(declaration, ModifierFlags.None));
@@ -1993,4 +1994,4 @@ function isProcessedComponent(node: Node): node is ProcessedComponent {
19931994
return true;
19941995
}
19951996
return false;
1996-
}
1997+
}

0 commit comments

Comments
 (0)