fix: 修复 TypeScript 最新版本报的编译错误

This commit is contained in:
Zhicheng Wang 2018-07-27 16:34:19 +08:00
parent cefbad3c50
commit 83e1c89d2c
3 changed files with 7 additions and 8 deletions

View File

@ -3,5 +3,5 @@
import { dirs } from '../dirs'; import { dirs } from '../dirs';
import { translateFile } from '../translate'; import { translateFile } from '../translate';
const filename = 'guide/aot-compiler.md'; const filename = 'guide/reactive-forms.md';
translateFile(__dirname + '/../../../../../content-en/' + filename, dirs.content + filename); translateFile(__dirname + '/../../../../../angular/aio/content/' + filename, dirs.content + filename);

View File

@ -10,7 +10,6 @@ import {
originalIsNotOnlyBeginTag, originalIsNotOnlyBeginTag,
originalIsNotPureCloseTag, originalIsNotPureCloseTag,
originalIsNotSpecialDivTag, originalIsNotSpecialDivTag,
translationHasNotCodeExample,
} from './utils'; } from './utils';
export function splitAndTrim(text = ''): string[] { export function splitAndTrim(text = ''): string[] {
@ -27,7 +26,7 @@ export function isTranslation(text) {
export function gatherTranslations(text: string): DictEntry[] { export function gatherTranslations(text: string): DictEntry[] {
const lines = splitAndTrim(normalizeLines(text)); const lines = splitAndTrim(normalizeLines(text));
const result = []; const result: any[] = [];
for (let i = 1; i < lines.length; ++i) { for (let i = 1; i < lines.length; ++i) {
const translation = purifyText(lines[i]); const translation = purifyText(lines[i]);
if (hasInlineText(translation)) { if (hasInlineText(translation)) {

View File

@ -35,15 +35,15 @@ export function isNotImg(entry: DictEntry): boolean {
} }
export function isNotCheatSheet(entry: DictEntry): boolean { export function isNotCheatSheet(entry: DictEntry): boolean {
return !/cheatsheet.md$/.test(entry.sourceFile); return !/cheatsheet.md$/.test(entry.sourceFile!!);
} }
export function isNotMarketingDocs(entry: DictEntry): boolean { export function isNotMarketingDocs(entry: DictEntry): boolean {
return !/marketing\/docs.md$/.test(entry.sourceFile); return !/marketing\/docs.md$/.test(entry.sourceFile!!);
} }
export function isNotCnPages(entry: DictEntry): boolean { export function isNotCnPages(entry: DictEntry): boolean {
return !/cn\/.*?.md$/.test(entry.sourceFile); return !/cn\/.*?.md$/.test(entry.sourceFile!!);
} }
export function isHead(line: string): boolean { export function isHead(line: string): boolean {
@ -166,7 +166,7 @@ export function fuzzyTest(text1: string, text2: string): boolean {
} }
export function exactlyTest(key: string, text: string): boolean { export function exactlyTest(key: string, text: string): boolean {
return key && key === text; return !!key && key === text;
} }
export function kernelText(text: string): string { export function kernelText(text: string): string {