make ts compiler options more strict
This commit is contained in:
@@ -22,7 +22,7 @@ export function getNamedImports(node: Node, moduleName: string): NamedImports[]
|
||||
export function getNamedImportAlias(node: Node, moduleName: string, importName: string): string | null {
|
||||
const [namedImportNode] = getNamedImports(node, moduleName);
|
||||
if (!namedImportNode) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
const query = `ImportSpecifier:has(Identifier[name="${importName}"]) > Identifier`;
|
||||
@@ -88,7 +88,7 @@ export function getStringsFromExpression(expression: Expression): string[] {
|
||||
|
||||
if (isArrayLiteralExpression(expression)) {
|
||||
return expression.elements.reduce((result: string[], element: Expression) => {
|
||||
const strings = this.getStringsFromExpression(element);
|
||||
const strings = getStringsFromExpression(element);
|
||||
return [
|
||||
...result,
|
||||
...strings
|
||||
@@ -97,8 +97,8 @@ export function getStringsFromExpression(expression: Expression): string[] {
|
||||
}
|
||||
|
||||
if (isBinaryExpression(expression)) {
|
||||
const [left] = this.getStringsFromExpression(expression.left);
|
||||
const [right] = this.getStringsFromExpression(expression.right);
|
||||
const [left] = getStringsFromExpression(expression.left);
|
||||
const [right] = getStringsFromExpression(expression.right);
|
||||
|
||||
if (expression.operatorToken.kind === SyntaxKind.PlusToken) {
|
||||
if (typeof left === 'string' && typeof right === 'string') {
|
||||
@@ -119,8 +119,8 @@ export function getStringsFromExpression(expression: Expression): string[] {
|
||||
}
|
||||
|
||||
if (isConditionalExpression(expression)) {
|
||||
const [whenTrue] = this.getStringsFromExpression(expression.whenTrue);
|
||||
const [whenFalse] = this.getStringsFromExpression(expression.whenFalse);
|
||||
const [whenTrue] = getStringsFromExpression(expression.whenTrue);
|
||||
const [whenFalse] = getStringsFromExpression(expression.whenFalse);
|
||||
|
||||
const result = [];
|
||||
if (typeof whenTrue === 'string') {
|
||||
|
@@ -33,7 +33,7 @@ export class TranslationCollection {
|
||||
|
||||
public filter(callback: (key?: string, val?: string) => boolean): TranslationCollection {
|
||||
let values: TranslationType = {};
|
||||
this.forEach((key: string, val: string) => {
|
||||
this.forEach((key, val) => {
|
||||
if (callback.call(this, key, val)) {
|
||||
values[key] = val;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export class TranslationCollection {
|
||||
|
||||
public map(callback: (key?: string, val?: string) => string): TranslationCollection {
|
||||
let values: TranslationType = {};
|
||||
this.forEach((key: string, val: string) => {
|
||||
this.forEach((key, val) => {
|
||||
values[key] = callback.call(this, key, val);
|
||||
});
|
||||
return new TranslationCollection(values);
|
||||
@@ -56,7 +56,7 @@ export class TranslationCollection {
|
||||
public intersect(collection: TranslationCollection): TranslationCollection {
|
||||
let values: TranslationType = {};
|
||||
this.filter(key => collection.has(key))
|
||||
.forEach((key: string, val: string) => {
|
||||
this.forEach((key, val) => {
|
||||
values[key] = val;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user