Skip to content

Commit d90fc07

Browse files
committed
Make linter happy
1 parent fad911c commit d90fc07

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

compiler/src/transform/expand-generics.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,18 @@ export class ExpansionConfig {
5151
* @return a new model with generics expanded
5252
*/
5353
export function expandGenerics (inputModel: Model, config?: ExpansionConfig): Model {
54-
5554
const typesToUnwrap = new Set<string>()
5655
const typesToInline: Set<string> = new Set<string>()
5756

58-
for (const name of config?.unwrappedTypes || []) {
57+
for (const name of config?.unwrappedTypes ?? []) {
5958
if (typeof name === 'string') {
6059
typesToUnwrap.add(name)
6160
} else {
6261
typesToUnwrap.add(nameKey(name))
6362
}
6463
}
6564

66-
for (const name of config?.inlinedTypes || []) {
65+
for (const name of config?.inlinedTypes ?? []) {
6766
if (typeof name === 'string') {
6867
typesToInline.add(name)
6968
} else {
@@ -336,28 +335,29 @@ export function expandGenerics (inputModel: Model, config?: ExpansionConfig): Mo
336335

337336
// If this is a type that has to be unwrapped, return its generic parameter's type
338337
if (typesToUnwrap.has(valueOfType)) {
339-
// @ts-ignore
340-
return expandValueOf(value.generics[0], mappings)
338+
// @ts-expect-error
339+
const x = value.generics[0]
340+
return expandValueOf(x, mappings)
341341
}
342342

343343
// If this is a type that has to be inlined
344344
if (typesToInline.has(valueOfType)) {
345345
// It has to be an alias (e.g. Stringified or WithNullValue
346346
const inlinedTypeDef = inputTypeByName.get(valueOfType)
347-
if (!inlinedTypeDef || inlinedTypeDef.kind !== 'type_alias') {
347+
if (inlinedTypeDef?.kind !== 'type_alias') {
348348
throw Error(`Inlined type ${valueOfType} should be an alias definition`)
349349
}
350350

351351
const inlineMappings = new Map<string, ValueOf>()
352-
for (let i = 0; i < (inlinedTypeDef.generics?.length || 0); i++) {
353-
// @ts-ignore
352+
for (let i = 0; i < (inlinedTypeDef.generics?.length ?? 0); i++) {
353+
// @ts-expect-error
354354
const source = inlinedTypeDef.generics[i]
355-
// @ts-ignore
356-
const dest = value.generics[i];
355+
// @ts-expect-error
356+
const dest = value.generics[i]
357357
inlineMappings.set(nameKey(source), dest)
358358
}
359359

360-
return expandValueOf(inlinedTypeDef.type, inlineMappings);
360+
return expandValueOf(inlinedTypeDef.type, inlineMappings)
361361
}
362362

363363
// If this is a generic parameter, return its mapping
@@ -486,7 +486,7 @@ async function expandGenericsFromFile (inPath: string, outPath: string): Promise
486486
const inputModel = JSON.parse(inputText)
487487
const outputModel = expandGenerics(inputModel, {
488488
// unwrappedTypes: ["_spec_utils:Stringified"],
489-
inlinedTypes: ["_spec_utils:WithNullValue"]
489+
inlinedTypes: ['_spec_utils:WithNullValue']
490490
})
491491

492492
await writeFile(

0 commit comments

Comments
 (0)