build: upgrade to TypeScript 2.8 (#23782)

PR Close #23782
This commit is contained in:
Lucas Sloan
2018-05-08 13:37:54 -07:00
committed by Alex Rickabaugh
parent e5e5c24d48
commit 5cf82f8f3f
15 changed files with 127 additions and 33 deletions

View File

@ -13,7 +13,7 @@
},
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"typescript": ">=2.7.2 <2.8"
"typescript": ">=2.7.2 <2.9"
},
"repository": {
"type": "git",

View File

@ -15,7 +15,7 @@
"chokidar": "^1.4.2"
},
"peerDependencies": {
"typescript": ">=2.7.2 <2.8",
"typescript": ">=2.7.2 <2.9",
"@angular/compiler": "0.0.0-PLACEHOLDER"
},
"engines" : {

View File

@ -108,7 +108,7 @@ const MIN_TS_VERSION = '2.7.2';
* ∀ supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '2.8.0';
const MAX_TS_VERSION = '2.9.0';
class AngularCompilerProgram implements Program {
private rootNames: string[];

View File

@ -141,13 +141,13 @@ class SanitizingHtmlSerializer {
const elAttrs = element.attributes;
for (let i = 0; i < elAttrs.length; i++) {
const elAttr = elAttrs.item(i);
const attrName = elAttr.name;
const attrName = elAttr !.name;
const lower = attrName.toLowerCase();
if (!VALID_ATTRS.hasOwnProperty(lower)) {
this.sanitizedSomething = true;
continue;
}
let value = elAttr.value;
let value = elAttr !.value;
// TODO(martinprobst): Special case image URIs for data:image/...
if (URI_ATTRS[lower]) value = _sanitizeUrl(value);
if (SRCSET_ATTRS[lower]) value = sanitizeSrcset(value);

View File

@ -146,7 +146,7 @@ export class InertBodyHelper {
// loop backwards so that we can support removals.
for (let i = elAttrs.length - 1; 0 < i; i--) {
const attrib = elAttrs.item(i);
const attrName = attrib.name;
const attrName = attrib !.name;
if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
el.removeAttribute(attrName);
}

View File

@ -64,7 +64,7 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
}
function typescriptOnly(ls: ts.LanguageService): ts.LanguageService {
return {
const languageService: ts.LanguageService = {
cleanupSemanticCache: () => ls.cleanupSemanticCache(),
getSyntacticDiagnostics: tryFilenameCall(ls.getSyntacticDiagnostics),
getSemanticDiagnostics: tryFilenameCall(ls.getSemanticDiagnostics),
@ -117,8 +117,13 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
getDefinitionAndBoundSpan: tryFilenameOneCall(ls.getDefinitionAndBoundSpan),
getCombinedCodeFix:
(scope: ts.CombinedCodeFixScope, fixId: {}, formatOptions: ts.FormatCodeSettings) =>
tryCall(undefined, () => ls.getCombinedCodeFix(scope, fixId, formatOptions))
};
tryCall(undefined, () => ls.getCombinedCodeFix(scope, fixId, formatOptions)),
// TODO(kyliau): dummy implementation to compile with ts 2.8, create real one
getSuggestionDiagnostics: (fileName: string) => [],
// TODO(kyliau): dummy implementation to compile with ts 2.8, create real one
organizeImports: (scope: ts.CombinedCodeFixScope, formatOptions: ts.FormatCodeSettings) => [],
} as ts.LanguageService;
return languageService;
}
oldLS = typescriptOnly(oldLS);

View File

@ -156,7 +156,8 @@ export class MockCache {
headers: {},
} as DehydratedResponse;
resp.headers.forEach((value, name) => { dehydratedResp.headers[name] = value; });
resp.headers.forEach(
(value: string, name: string) => { dehydratedResp.headers[name] = value; });
dehydrated[url] = dehydratedResp;
});

View File

@ -11,7 +11,7 @@ import {ApplicationRef, ChangeDetectorRef, ComponentFactory, ComponentRef, Event
import * as angular from './angular1';
import {PropertyBinding} from './component_info';
import {$SCOPE} from './constants';
import {getAttributesAsArray, getComponentName, hookupNgModel, strictEquals} from './util';
import {getComponentName, hookupNgModel, strictEquals} from './util';
const INITIAL_VALUE = {
__UNINITIALIZED__: true

View File

@ -32,19 +32,6 @@ export function directiveNormalize(name: string): string {
.replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());
}
export function getAttributesAsArray(node: Node): [string, string][] {
const attributes = node.attributes;
let asArray: [string, string][] = undefined !;
if (attributes) {
let attrLen = attributes.length;
asArray = new Array(attrLen);
for (let i = 0; i < attrLen; i++) {
asArray[i] = [attributes[i].nodeName, attributes[i].nodeValue !];
}
}
return asArray || [];
}
export function getComponentName(component: Type<any>): string {
// Return the name of the component or the first line of its stringified version.
return (component as any).overriddenName || component.name || component.toString().split('\n')[0];