Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ http_archive(

http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/7c49a0943e7ccca73bee0b8fc5f01ca2c3dcfe8b.zip",
strip_prefix = "rules_typescript-7c49a0943e7ccca73bee0b8fc5f01ca2c3dcfe8b",
sha256 = "9707cdafc0e59f06cf5336b1c68d8f3d04fae9f3471c0eb205a669b8b5fafc81",
url = "https://github.com/rkirov/rules_typescript/archive/v0.16.0.zip",
strip_prefix = "rules_typescript-0.16.0",
sha256 = "f5aedd3a792e5af19cd0c0f0318cb692e2989e816e896e794152d07808fccacd",
)

http_archive(
Expand Down
49 changes: 49 additions & 0 deletions integration/typings_test_ts29/include-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import * as compiler from '@angular/compiler';
import * as compilerTesting from '@angular/compiler/testing';
import * as core from '@angular/core';
import * as coreTesting from '@angular/core/testing';
import * as elements from '@angular/elements';
import * as forms from '@angular/forms';
import * as http from '@angular/http';
import * as httpTesting from '@angular/http/testing';
import * as platformBrowser from '@angular/platform-browser';
import * as platformBrowserTesting from '@angular/platform-browser/testing';
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
import * as platformServer from '@angular/platform-server';
import * as platformServerTesting from '@angular/platform-server/testing';
import * as platformWebworker from '@angular/platform-webworker';
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
import * as router from '@angular/router';
import * as routerTesting from '@angular/router/testing';
import * as serviceWorker from '@angular/service-worker';
import * as upgrade from '@angular/upgrade';

export default {
compiler,
compilerTesting,
core,
coreTesting,
elements,
forms,
http,
httpTesting,
platformBrowser,
platformBrowserTesting,
platformBrowserDynamic,
platformServer,
platformServerTesting,
platformWebworker,
platformWebworkerDynamic,
router,
routerTesting,
serviceWorker,
upgrade,
};
31 changes: 31 additions & 0 deletions integration/typings_test_ts29/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 2.8 can type-check an Angular application",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/elements": "file:../../dist/packages-dist/elements",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/http": "file:../../dist/packages-dist/http",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
"@angular/router": "file:../../dist/packages-dist/router",
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"@types/jasmine": "2.5.41",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "2.8.x",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhevery Is it not weird to have 2.8.x in the package.json of typings_test_ts29. Shouldn't that be 2.9.x (and in the description above)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #24749 to fix it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, and thanks for the fix.

"zone.js": "file:../../node_modules/zone.js"
},
"scripts": {
"test": "tsc"
}
}
24 changes: 24 additions & 0 deletions integration/typings_test_ts29/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts28/",
"rootDir": ".",
"target": "es5",
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
],
"types": [],
"strictNullChecks": true
},
"files": [
"include-all.ts",
"node_modules/@types/jasmine/index.d.ts"
]
}
6 changes: 2 additions & 4 deletions modules/benchmarks/src/tree/ng2_next/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
*/

import {NgIf} from '@angular/common';
import {ComponentFactory, ComponentFactoryResolver, ComponentRef, ErrorHandler, Injector, NgModuleRef, RendererFactory2, RootRenderer, Sanitizer, TemplateRef, ViewContainerRef} from '@angular/core';
import {ArgumentType, BindingFlags, NodeFlags, ViewDefinition, ViewFlags, anchorDef, createComponentFactory, directiveDef, elementDef, initServicesIfNeeded, textDef, viewDef} from '@angular/core/src/view/index';
import {DomRendererFactory2} from '@angular/platform-browser/src/dom/dom_renderer';
import {DomSanitizerImpl, SafeStyle} from '@angular/platform-browser/src/security/dom_sanitization_service';
import {ComponentFactory, ComponentFactoryResolver, ComponentRef, ErrorHandler, Injector, NgModuleRef, RendererFactory2, RootRenderer, Sanitizer, TemplateRef, ViewContainerRef, ɵArgumentType as ArgumentType, ɵBindingFlags as BindingFlags, ɵNodeFlags as NodeFlags, ɵViewDefinition as ViewDefinition, ɵViewFlags as ViewFlags, ɵand as anchorDef, ɵccf as createComponentFactory, ɵdid as directiveDef, ɵeld as elementDef, ɵinitServicesIfNeeded as initServicesIfNeeded, ɵted as textDef, ɵvid as viewDef} from '@angular/core';
import {SafeStyle, ɵDomRendererFactory2 as DomRendererFactory2, ɵDomSanitizerImpl as DomSanitizerImpl} from '@angular/platform-browser';

import {TreeNode, emptyTree} from '../util';

Expand Down
5 changes: 2 additions & 3 deletions modules/benchmarks/src/tree/render3/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import {ɵC as C, ɵE as E, ɵRenderFlags as RenderFlags, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵi1 as i1, ɵp as p, ɵsn as sn, ɵt as t, ɵv as v} from '@angular/core';
import {ComponentDefInternal} from '@angular/core/src/render3/interfaces/definition';

import {TreeNode, buildTree, emptyTree} from '../util';

Expand Down Expand Up @@ -35,7 +34,7 @@ export class TreeComponent {
data: TreeNode = emptyTree;

/** @nocollapse */
static ngComponentDef: ComponentDefInternal<TreeComponent> = defineComponent({
static ngComponentDef = defineComponent({
type: TreeComponent,
selectors: [['tree']],
template: function(rf: RenderFlags, ctx: TreeComponent) {
Expand Down Expand Up @@ -95,7 +94,7 @@ export class TreeFunction {
data: TreeNode = emptyTree;

/** @nocollapse */
static ngComponentDef: ComponentDefInternal<TreeFunction> = defineComponent({
static ngComponentDef = defineComponent({
type: TreeFunction,
selectors: [['tree']],
template: function(rf: RenderFlags, ctx: TreeFunction) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@
"source-map": "0.5.7",
"source-map-support": "0.4.18",
"systemjs": "0.18.10",
"tsickle": "^0.29.0",
"tsickle": "0.32",
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.20.0",
"typescript": "2.8.x",
"typescript": "2.9.x",
"uglify-es": "^3.3.9",
"universal-analytics": "0.4.15",
"vlq": "0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"typescript": ">=2.7.2 <2.9"
"typescript": ">=2.7.2 <2.10"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/ng_package/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function main(args: string[]): number {
allsrcs.filter(hasFileExtension('.d.ts')).forEach((f: string) => {
const content = fs.readFileSync(f, 'utf-8')
// Strip the named AMD module for compatibility with non-bazel users
.replace(/^\/\/\/ <amd-module name=.*\/>\n/, '');
.replace(/^\/\/\/ <amd-module name=.*\/>\n/gm, '');
writeFileFromInputPath(f, content);
});

Expand Down
4 changes: 4 additions & 0 deletions packages/common/locales/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ npm_package(
# We don't actually import anything in the locale code so we can
# null out the require reference passed into the module.
"factory\(require, exports\)": "factory(null, exports)",

# Workaround for `.d.ts`` containing `/// <amd-module .../>`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not strictly the case - they were generated in ts < 2.9, but not validated?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it was tsickle adding them before.

# which are generated in TypeScript v2.9, but not before.
"/// <amd-module name=.*/>": "",
},
deps = [":locales"],
)
4 changes: 2 additions & 2 deletions packages/compiler-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"dependencies": {
"reflect-metadata": "^0.1.2",
"minimist": "^1.2.0",
"tsickle": "^0.29.0",
"tsickle": "^0.30.0",
"chokidar": "^1.4.2"
},
"peerDependencies": {
"typescript": ">=2.7.2 <2.9",
"typescript": ">=2.7.2 <2.10",
"@angular/compiler": "0.0.0-PLACEHOLDER"
},
"engines" : {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/transformers/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,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.9.0';
const MAX_TS_VERSION = '2.10.0';

class AngularCompilerProgram implements Program {
private rootNames: string[];
Expand Down
33 changes: 1 addition & 32 deletions packages/compiler-cli/test/metadata/collector_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ describe('Collector', () => {
});
});

describe('regerssion', () => {
describe('regression', () => {
it('should be able to collect a short-hand property value', () => {
const metadata = collectSource(`
const children = { f1: 1 };
Expand Down Expand Up @@ -1040,37 +1040,6 @@ describe('Collector', () => {
.not.toBeUndefined('typeGuard was not collected');
});

it('should be able to collect an invalid access expression', () => {
const source = createSource(`
import {Component} from '@angular/core';

const value = [];
@Component({
provider: [{provide: 'some token', useValue: value[]}]
})
export class MyComponent {}
`);
const metadata = collector.getMetadata(source) !;
expect(metadata.metadata.MyComponent).toEqual({
__symbolic: 'class',
decorators: [{
__symbolic: 'call',
expression: {
__symbolic: 'reference',
module: '@angular/core',
name: 'Component',
line: 4,
character: 9
},
arguments: [{
__symbolic: 'error',
message: 'Expression form not supported',
line: 5,
character: 55
}]
}]
});
});
});

describe('references', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core_private_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export {_sanitizeUrl as ɵ_sanitizeUrl} from './sanitization/url_sanitizer';
export {global as ɵglobal, looseIdentical as ɵlooseIdentical, stringify as ɵstringify} from './util';
export {makeDecorator as ɵmakeDecorator} from './util/decorators';
export {isObservable as ɵisObservable, isPromise as ɵisPromise} from './util/lang';
export {clearOverrides as ɵclearOverrides, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
export {clearOverrides as ɵclearOverrides, initServicesIfNeeded as ɵinitServicesIfNeeded, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
export {NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from './view/provider';
2 changes: 1 addition & 1 deletion packages/core/src/render3/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export function defineComponent<T>(componentDefinition: {
const type = componentDefinition.type;
const pipeTypes = componentDefinition.pipes !;
const directiveTypes = componentDefinition.directives !;
const declaredInputs: {[P in keyof T]: P} = {} as any;
const declaredInputs: {[key: string]: string} = {} as any;
const def: ComponentDefInternal<any> = {
type: type,
diPublic: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/render3/instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ export function baseDirectiveCreate<T>(
* @param tNode The static data for this node
*/
function setInputsFromAttrs<T>(
directiveIndex: number, instance: T, inputs: {[key: string]: string}, tNode: TNode): void {
directiveIndex: number, instance: T, inputs: {[P in keyof T]: string;}, tNode: TNode): void {
let initialInputData = tNode.initialInputs as InitialInputData | undefined;
if (initialInputData === undefined || directiveIndex >= initialInputData.length) {
initialInputData = generateInitialInputs(directiveIndex, inputs, tNode);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/render3/interfaces/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface DirectiveDef<T, Selector extends string> {
type: Type<T>;

/** Function that makes a directive public to the DI system. */
diPublic: ((def: DirectiveDef<any, string>) => void)|null;
diPublic: ((def: DirectiveDef<T, string>) => void)|null;

/** The selectors that will be used to match nodes to this directive. */
selectors: CssSelectorList;
Expand All @@ -94,7 +94,7 @@ export interface DirectiveDef<T, Selector extends string> {
* are their aliases if any, or their original unminified property names
* (as in `@Input('alias') propertyName: any;`).
*/
readonly inputs: {[P in keyof T]: P};
readonly inputs: {[P in keyof T]: string};

/**
* @deprecated This is only here because `NgOnChanges` incorrectly uses declared name instead of
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

// Import zero symbols from zone.js. This causes the zone ambient type to be
// added to the type-checker, without emitting any runtime module load statement
import {} from 'zone.js';

// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
declare var WorkerGlobalScope: any /** TODO #9100 */;
// CommonJS / Node have global context exposed as "global" variable.
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/zone/ng_zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

// Import zero symbols from zone.js. This causes the zone ambient type to be
// added to the type-checker, without emitting any runtime module load statement
import {} from 'zone.js';
import {EventEmitter} from '../event_emitter';

/**
Expand Down
26 changes: 20 additions & 6 deletions packages/language-service/src/ts_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
tryCall(fileName, () => <T>(m.call(ls, fileName, p1, p2, p3, p4)));
}

function tryFilenameFiveCall<T, P1, P2, P3, P4, P5>(
m: (fileName: string, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) =>
T): (fileName: string, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => T {
return (fileName, p1, p2, p3, p4, p5) =>
tryCall(fileName, () => <T>(m.call(ls, fileName, p1, p2, p3, p4, p5)));
}


function typescriptOnly(ls: ts.LanguageService): ts.LanguageService {
const languageService: ts.LanguageService = {
cleanupSemanticCache: () => ls.cleanupSemanticCache(),
Expand All @@ -74,7 +82,7 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
getEncodedSyntacticClassifications: tryFilenameOneCall(ls.getEncodedSyntacticClassifications),
getEncodedSemanticClassifications: tryFilenameOneCall(ls.getEncodedSemanticClassifications),
getCompletionsAtPosition: tryFilenameTwoCall(ls.getCompletionsAtPosition),
getCompletionEntryDetails: tryFilenameFourCall(ls.getCompletionEntryDetails),
getCompletionEntryDetails: tryFilenameFiveCall(ls.getCompletionEntryDetails),
getCompletionEntrySymbol: tryFilenameThreeCall(ls.getCompletionEntrySymbol),
getQuickInfoAtPosition: tryFilenameOneCall(ls.getQuickInfoAtPosition),
getNameOrDottedNameSpan: tryFilenameTwoCall(ls.getNameOrDottedNameSpan),
Expand Down Expand Up @@ -106,22 +114,28 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
getDocCommentTemplateAtPosition: tryFilenameOneCall(ls.getDocCommentTemplateAtPosition),
isValidBraceCompletionAtPosition: tryFilenameTwoCall(ls.isValidBraceCompletionAtPosition),
getSpanOfEnclosingComment: tryFilenameTwoCall(ls.getSpanOfEnclosingComment),
getCodeFixesAtPosition: tryFilenameFourCall(ls.getCodeFixesAtPosition),
getCodeFixesAtPosition: tryFilenameFiveCall(ls.getCodeFixesAtPosition),
applyCodeActionCommand:
<any>((action: any) => tryCall(undefined, () => ls.applyCodeActionCommand(action))),
getEmitOutput: tryFilenameCall(ls.getEmitOutput),
getProgram: () => ls.getProgram(),
dispose: () => ls.dispose(),
getApplicableRefactors: tryFilenameOneCall(ls.getApplicableRefactors),
getEditsForRefactor: tryFilenameFourCall(ls.getEditsForRefactor),
getApplicableRefactors: tryFilenameTwoCall(ls.getApplicableRefactors),
getEditsForRefactor: tryFilenameFiveCall(ls.getEditsForRefactor),
getDefinitionAndBoundSpan: tryFilenameOneCall(ls.getDefinitionAndBoundSpan),
getCombinedCodeFix:
(scope: ts.CombinedCodeFixScope, fixId: {}, formatOptions: ts.FormatCodeSettings) =>
tryCall(undefined, () => ls.getCombinedCodeFix(scope, fixId, formatOptions)),
(scope: ts.CombinedCodeFixScope, fixId: {}, formatOptions: ts.FormatCodeSettings,
preferences: ts.UserPreferences) =>
tryCall(
undefined, () => ls.getCombinedCodeFix(scope, fixId, formatOptions, preferences)),
// 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) => [],
// TODO: dummy implementation to compile with ts 2.9, create a real one
getEditsForFileRename:
(oldFilePath: string, newFilePath: string, formatOptions: ts.FormatCodeSettings,
preferences: ts.UserPreferences | undefined) => []
} as ts.LanguageService;
return languageService;
}
Expand Down
Loading