Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Feb 6, 2023
1 parent 2bd0e34 commit c332cba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/compilerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function isCompilerOptionEnabled(
);
case "declaration":
return (
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
options.declaration || isCompilerOptionEnabled(options, "composite")
);
case "incremental":
Expand All @@ -54,6 +55,7 @@ export function isCompilerOptionEnabled(
: options.incremental;
case "skipDefaultLibCheck":
return (
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
options.skipDefaultLibCheck ||
isCompilerOptionEnabled(options, "skipLibCheck")
);
Expand Down Expand Up @@ -86,7 +88,7 @@ export function isCompilerOptionEnabled(
type AssertEqual<T, U extends T> = U; // make sure all strict options are handled here
return isStrictCompilerOptionEnabled(
options,
<AssertEqual<typeof option, StrictCompilerOption>>option
option as AssertEqual<typeof option, StrictCompilerOption>
);
}
return options[option] === true;
Expand Down
15 changes: 9 additions & 6 deletions src/types/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {

export function getCallSignaturesOfType(
type: ts.Type
): ReadonlyArray<ts.Signature> {
): readonly ts.Signature[] {
if (isUnionType(type)) {
const signatures = [];
for (const t of type.types) signatures.push(...getCallSignaturesOfType(t));
return signatures;
}
if (isIntersectionType(type)) {
let signatures: ReadonlyArray<ts.Signature> | undefined;
let signatures: readonly ts.Signature[] | undefined;
for (const t of type.types) {
const sig = getCallSignaturesOfType(t);
if (sig.length !== 0) {
Expand Down Expand Up @@ -47,9 +47,10 @@ export function getWellKnownSymbolPropertyOfType(
if (!prop.name.startsWith(prefix)) continue;
const globalSymbol = checker.getApparentType(
checker.getTypeAtLocation(
(<ts.ComputedPropertyName>(
(<ts.NamedDeclaration>prop.valueDeclaration).name
)).expression
(
(prop.valueDeclaration as ts.NamedDeclaration)
.name as ts.ComputedPropertyName
).expression
)
).symbol;
if (
Expand All @@ -75,16 +76,18 @@ function getPropertyNameOfWellKnownSymbol(
checker
.getTypeOfSymbolAtLocation(
symbolConstructor,
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
(symbolConstructor as any).valueDeclaration
)
.getProperty(symbolName);
const knownSymbolType =
knownSymbol &&
checker.getTypeOfSymbolAtLocation(
knownSymbol,
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
(knownSymbol as any).valueDeclaration
);
if (knownSymbolType && isUniqueESSymbolType(knownSymbolType))
return knownSymbolType.escapedName;
return <ts.__String>("__@" + symbolName);
return ("__@" + symbolName) as ts.__String;
}

0 comments on commit c332cba

Please sign in to comment.