Skip to content

Commit e2c2b45

Browse files
committed
Lint and format
1 parent 728ad87 commit e2c2b45

6 files changed

Lines changed: 6 additions & 27 deletions

File tree

packages/compiler/src/core/checker.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5096,10 +5096,7 @@ export function createChecker(program: Program, resolver: NameResolver): Checker
50965096
let valueType: Type | undefined;
50975097
let type: Type | undefined;
50985098
if (constraint.valueType) {
5099-
if (
5100-
constraint.valueType.kind === "Model" &&
5101-
isArrayModelType(constraint.valueType)
5102-
) {
5099+
if (constraint.valueType.kind === "Model" && isArrayModelType(constraint.valueType)) {
51035100
valueType = constraint.valueType.indexer.value;
51045101
} else {
51055102
return undefined;

packages/compiler/src/core/type-relation-checker.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,7 @@ export function createTypeRelationChecker(program: Program, checker: Checker): T
321321
}),
322322
],
323323
];
324-
} else if (
325-
target.kind === "Model" &&
326-
isArrayModelType(target) &&
327-
source.kind === "Model"
328-
) {
324+
} else if (target.kind === "Model" && isArrayModelType(target) && source.kind === "Model") {
329325
if (isArrayModelType(source)) {
330326
return hasIndexAndIsAssignableTo(
331327
source,
@@ -339,11 +335,7 @@ export function createTypeRelationChecker(program: Program, checker: Checker): T
339335
}
340336
} else if (target.kind === "Model" && source.kind === "Model") {
341337
return areModelsRelated(source, target, diagnosticTarget, relationCache);
342-
} else if (
343-
target.kind === "Model" &&
344-
isArrayModelType(target) &&
345-
source.kind === "Tuple"
346-
) {
338+
} else if (target.kind === "Model" && isArrayModelType(target) && source.kind === "Tuple") {
347339
return isTupleAssignableToArray(source, target, diagnosticTarget, relationCache);
348340
} else if (target.kind === "Tuple" && source.kind === "Tuple") {
349341
return isTupleAssignableToTuple(source, target, diagnosticTarget, relationCache);

packages/compiler/src/lib/decorators.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,7 @@ function validateTargetingAnArray(
390390
decoratorName: string,
391391
) {
392392
const targetType = getTypeForArrayValidation(target);
393-
const valid = isTypeIn(
394-
targetType,
395-
(x) => x.kind === "Model" && isArrayModelType(x),
396-
);
393+
const valid = isTypeIn(targetType, (x) => x.kind === "Model" && isArrayModelType(x));
397394
if (!valid) {
398395
reportDiagnostic(context.program, {
399396
code: "decorator-wrong-target",

packages/http-server-csharp/src/lib/type-helpers.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ export function getEnumType(en: Enum): EnumValueType | undefined {
7070
* @returns true if the type is an array or a model property with array type, otherwise false
7171
*/
7272
export function isArrayType(program: Program, type: ModelProperty | Scalar): boolean {
73-
return (
74-
type.kind === "ModelProperty" &&
75-
type.type.kind === "Model" &&
76-
isArrayModelType(type.type)
77-
);
73+
return type.kind === "ModelProperty" && type.type.kind === "Model" && isArrayModelType(type.type);
7874
}
7975

8076
/** Inner representation of s string constraint */

packages/http-server-js/src/ctx.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export type DeclarationType = Model | Enum | Union | Interface | Scalar;
4747
*/
4848
export function isImportableType(ctx: JsContext, t: Type): t is DeclarationType {
4949
return (
50-
(t.kind === "Model" &&
51-
!isArrayModelType(t) &&
52-
!isRecordModelType(t)) ||
50+
(t.kind === "Model" && !isArrayModelType(t) && !isRecordModelType(t)) ||
5351
t.kind === "Enum" ||
5452
t.kind === "Interface"
5553
);

packages/tspd/src/gen-extern-signatures/components/decorator-signature-type.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ function getCompilerType(name: string) {
178178
}
179179

180180
function ValueTsType({ type }: { type: Type }) {
181-
const { program } = useTspd();
182181
switch (type.kind) {
183182
case "Boolean":
184183
return `${type.value}`;

0 commit comments

Comments
 (0)