diff --git a/package.json b/package.json
index 6f208d3..4e81694 100644
--- a/package.json
+++ b/package.json
@@ -3,9 +3,7 @@
"version": "3.0.3",
"description": "Angular 2 decorators and utils for Angular 1.x",
"scripts": {
- "typings": "typings",
- "typings:install": "typings install",
- "prepublish": "npm run typings:install && tsc && ./scripts/create_core.sh",
+ "prepublish": "tsc",
"start": "tsc -w",
"test": "mocha ./test/index.ts --require ts-node/register --colors --watch-extensions ts",
"test:watch": "npm run test -- --watch",
@@ -31,8 +29,14 @@
},
"homepage": "https://github.com/ngParty/ng-metadata#readme",
"devDependencies": {
+ "@types/angular": "1.5.19",
+ "@types/chai": "3.4.34",
+ "@types/jquery": "2.0.34",
+ "@types/mocha": "2.2.32",
+ "@types/node": "6.0.46",
+ "@types/sinon": "1.16.31",
"angular": "1.4.10",
- "chai": "3.4.1",
+ "chai": "3.5.0",
"commitizen": "2.4.6",
"concurrently": "2.1.0",
"conventional-changelog": "1.1.0",
@@ -40,15 +44,13 @@
"cz-conventional-changelog": "1.1.4",
"ghooks": "1.0.1",
"live-server": "0.8.2",
- "mocha": "2.3.4",
- "reflect-metadata": "0.1.3",
+ "mocha": "3.1.2",
+ "reflect-metadata": "0.1.8",
"rxjs": "5.0.0-rc.1",
- "sinon": "1.17.2",
+ "sinon": "1.17.6",
"systemjs": "0.19.6",
- "systemjs-builder": "0.14.11",
- "ts-node": "0.7.3",
- "typescript": "2.0.3",
- "typings": "1.0.4",
+ "ts-node": "1.7.0",
+ "typescript": "2.0.9",
"validate-commit-msg": "2.0.0"
},
"peerDependencies": {
diff --git a/playground/app/components/change-detector/change-detector.component.ts b/playground/app/components/change-detector/change-detector.component.ts
index 9568903..84c8073 100644
--- a/playground/app/components/change-detector/change-detector.component.ts
+++ b/playground/app/components/change-detector/change-detector.component.ts
@@ -1,3 +1,4 @@
+import * as angular from 'angular';
import {
Component,
ChangeDetectionStrategy,
diff --git a/playground/app/components/tester/tester.component.ts b/playground/app/components/tester/tester.component.ts
index a700567..1e11253 100644
--- a/playground/app/components/tester/tester.component.ts
+++ b/playground/app/components/tester/tester.component.ts
@@ -1,3 +1,4 @@
+import * as angular from 'angular';
import { Component, Input, Output } from 'ng-metadata/core';
@Component({
diff --git a/playground/app/directives/my-tester.directive.ts b/playground/app/directives/my-tester.directive.ts
index 4b0bb25..3635790 100644
--- a/playground/app/directives/my-tester.directive.ts
+++ b/playground/app/directives/my-tester.directive.ts
@@ -1,3 +1,4 @@
+import * as angular from 'angular';
import { Directive, Input, Output, Attr, HostListener } from 'ng-metadata/core';
@Directive({
diff --git a/playground/app/index.ts b/playground/app/index.ts
index af8fad6..63b8d4a 100644
--- a/playground/app/index.ts
+++ b/playground/app/index.ts
@@ -1,3 +1,6 @@
+// @FIXME remove this line when https://github.com/ngParty/ng-metadata/issues/175 is resolved
+///
+
import * as angular from 'angular';
import { provide, OpaqueToken, Injectable } from 'ng-metadata/core';
diff --git a/playground/app/todo/add-todo.component.ts b/playground/app/todo/add-todo.component.ts
index 9554c50..fff9297 100644
--- a/playground/app/todo/add-todo.component.ts
+++ b/playground/app/todo/add-todo.component.ts
@@ -1,5 +1,5 @@
import { Component, Output, EventEmitter } from 'ng-metadata/core';
-import { TodoModel } from './todo-store.service.ts';
+import { TodoModel } from './todo-store.service';
@Component({
selector: 'add-todo',
diff --git a/playground/app/todo/todo-store.service.ts b/playground/app/todo/todo-store.service.ts
index b93897f..f3b929f 100644
--- a/playground/app/todo/todo-store.service.ts
+++ b/playground/app/todo/todo-store.service.ts
@@ -1,3 +1,4 @@
+import * as angular from 'angular';
import {Injectable} from 'ng-metadata/core';
export type TodoModel = {
diff --git a/playground/ng-metadata.legacy.d.ts b/playground/ng-metadata.legacy.d.ts
index a32a484..94e907b 100644
--- a/playground/ng-metadata.legacy.d.ts
+++ b/playground/ng-metadata.legacy.d.ts
@@ -1,3 +1,4 @@
+// import * as angular from 'angular';
// import Subject = require('rxjs/Subject');
declare type Observable = any;
declare type Subject = any;
@@ -1014,6 +1015,7 @@ declare module ngMetadataCommon {
$isEmpty(value: any): boolean;
}
export abstract class NgForm implements ng.IFormController {
+ $name: string;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
@@ -1021,9 +1023,9 @@ declare module ngMetadataCommon {
$submitted: boolean;
$error: any;
$pending: any;
- $addControl(control: angular.INgModelController): void;
- $removeControl(control: angular.INgModelController): void;
- $setValidity(validationErrorKey: string, isValid: boolean, control: angular.INgModelController): void;
+ $addControl(control: ng.INgModelController): void;
+ $removeControl(control: ng.INgModelController): void;
+ $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void;
$setDirty(): void;
$setPristine(): void;
$commitViewValue(): void;
@@ -1067,14 +1069,3 @@ declare module "ng-metadata/common" {
export = ngMetadataCommon
}
declare type Type = Function;
-declare type ProvideSpreadType = string|Type;
-
-declare module angular {
- interface IModule {
- // constant(object: Object): IModule;
- // value(object: Object): IModule;
- directive(...args: ProvideSpreadType[]): IModule;
- filter(...args: ProvideSpreadType[]): IModule;
- service(...args: ProvideSpreadType[]): IModule;
- }
-}
diff --git a/playground/tsconfig.json b/playground/tsconfig.json
index e54b9e5..bca043b 100644
--- a/playground/tsconfig.json
+++ b/playground/tsconfig.json
@@ -6,11 +6,15 @@
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
- "pretty": true
+ "pretty": true,
+ "lib": [
+ "es5",
+ "dom",
+ "es2015.promise"
+ ]
},
"files": [
- "app/main.ts",
- "../typings/index.d.ts",
- "ng-metadata.legacy.d.ts"
+ "./app/main.ts",
+ "./ng-metadata.legacy.d.ts"
]
}
diff --git a/scripts/create_core.sh b/scripts/create_core.sh
deleted file mode 100755
index 3f90b3e..0000000
--- a/scripts/create_core.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-cat scripts/typings_import.txt >> core.d.ts
-
diff --git a/scripts/typings_import.txt b/scripts/typings_import.txt
deleted file mode 100644
index fde837b..0000000
--- a/scripts/typings_import.txt
+++ /dev/null
@@ -1 +0,0 @@
-import './manual_typings/globals.d.ts';
diff --git a/src/common/directives/ng_form.ts b/src/common/directives/ng_form.ts
index 85ad35d..1f6280c 100644
--- a/src/common/directives/ng_form.ts
+++ b/src/common/directives/ng_form.ts
@@ -11,11 +11,11 @@ export abstract class NgForm implements ng.IFormController {
$name: string;
$pending: any;
- $addControl( control: angular.INgModelController ): void {}
+ $addControl( control: ng.INgModelController ): void {}
- $removeControl( control: angular.INgModelController ): void {}
+ $removeControl( control: ng.INgModelController ): void {}
- $setValidity( validationErrorKey: string, isValid: boolean, control: angular.INgModelController ): void {}
+ $setValidity( validationErrorKey: string, isValid: boolean, control: ng.INgModelController ): void {}
$setDirty(): void {}
diff --git a/src/core/directives/binding/binding_factory.ts b/src/core/directives/binding/binding_factory.ts
index 775fac0..ab5ce5d 100644
--- a/src/core/directives/binding/binding_factory.ts
+++ b/src/core/directives/binding/binding_factory.ts
@@ -110,7 +110,7 @@ export function _createDirectiveBindings(
oldValue = initialValue;
}
recordChanges( propName, newValue, oldValue );
- ctrl[ propName ] = isImmutable ? angular.copy(newValue) : newValue;
+ ctrl[ propName ] = isImmutable ? global.angular.copy(newValue) : newValue;
}, parentGet.literal );
}
diff --git a/src/core/directives/host/host_resolver.ts b/src/core/directives/host/host_resolver.ts
index 20052f1..17b590c 100644
--- a/src/core/directives/host/host_resolver.ts
+++ b/src/core/directives/host/host_resolver.ts
@@ -1,4 +1,5 @@
import { HostBindingsProcessed, HostListenersProcessed } from './constants';
+import { global } from '../../../facade/lang';
import { StringMapWrapper } from '../../../facade/collections';
import { StringWrapper } from '../../../facade/primitives';
/**
@@ -171,11 +172,11 @@ function _getGlobalTargetReference( $injector: ng.auto.IInjectorService, targetN
}
if ( targetName === 'window' ) {
- return angular.element( $injector.get( `$${targetName}` ) );
+ return global.angular.element( $injector.get( `$${targetName}` ) );
}
if ( targetName === 'body' ) {
- return angular.element($document[ 0 ][ targetName ]);
+ return global.angular.element($document[ 0 ][ targetName ]);
}
throw new Error(`unsupported global target '${targetName}', only '${globalEventTargets}' are supported`)
diff --git a/src/facade/lang.ts b/src/facade/lang.ts
index ec31151..1ccae4b 100644
--- a/src/facade/lang.ts
+++ b/src/facade/lang.ts
@@ -20,10 +20,10 @@ export interface BrowserNodeGlobal {
setTimeout: Function,
clearTimeout: Function,
setInterval: Function,
- clearInterval: Function
+ clearInterval: Function,
}
-var globalScope: BrowserNodeGlobal;
+let globalScope: BrowserNodeGlobal;
if ( typeof window === 'undefined' ) {
globalScope = global as any;
@@ -33,7 +33,7 @@ if ( typeof window === 'undefined' ) {
// Need to declare a new variable for global here since TypeScript
// exports the original value of the symbol.
-var _global: BrowserNodeGlobal = globalScope;
+const _global: BrowserNodeGlobal = globalScope;
export {_global as global};
diff --git a/src/platform/browser_utils.ts b/src/platform/browser_utils.ts
index d80b818..cdd427e 100644
--- a/src/platform/browser_utils.ts
+++ b/src/platform/browser_utils.ts
@@ -1,4 +1,4 @@
-import { assertionsEnabled } from '../facade/lang';
+import { global, assertionsEnabled } from '../facade/lang';
import { bundle } from '../core/util/bundler';
import { Type } from '../facade/type';
@@ -19,7 +19,7 @@ function prodModeConfig( $compileProvider: ng.ICompileProvider, $httpProvider: n
$httpProvider.useApplyAsync( true );
}
-export function createBootstrapFn(bootstrapFn: Function = angular.bootstrap.bind(angular)): Function {
+export function createBootstrapFn(bootstrapFn: Function = global.angular.bootstrap.bind(global.angular)): Function {
/**
* bootstrap angular app
@@ -40,12 +40,12 @@ export function createBootstrapFn(bootstrapFn: Function = angular.bootstrap.bind
'Angular is running in the development mode. Call enableProdMode() to enable the production mode.'
);
} else {
- angular.module( angular1ModuleName ).config( prodModeConfig );
+ global.angular.module( angular1ModuleName ).config( prodModeConfig );
}
const appRoot = _getAppRoot( element );
- angular.element( document ).ready( ()=> {
+ global.angular.element( document ).ready( ()=> {
bootstrapFn( appRoot, [ angular1ModuleName ], {
strictDi
} )
diff --git a/src/testing/utils.ts b/src/testing/utils.ts
index 3875f89..cf6b1c0 100644
--- a/src/testing/utils.ts
+++ b/src/testing/utils.ts
@@ -1,6 +1,7 @@
import { getInjectableName } from '../core/di/provider';
import { StringWrapper } from '../facade/primitives';
import { Type } from '../facade/type';
+import { global } from '../facade/lang';
// public helpers
@@ -42,7 +43,7 @@ export function renderFactory( $compile: ng.ICompileService, $scope: any ) {
// is Component
const hostElement = `<${selector}>${selector}>`;
- jqHost = angular.element( hostElement );
+ jqHost = global.angular.element( hostElement );
}
// since attributes can be undefined we check them
diff --git a/src/upgrade/upgrade_adapter.ts b/src/upgrade/upgrade_adapter.ts
index 981dd08..fe7730b 100644
--- a/src/upgrade/upgrade_adapter.ts
+++ b/src/upgrade/upgrade_adapter.ts
@@ -19,7 +19,7 @@ export interface UpgradeAdapterInstance {
/**
* Bootstrap a hybrid AngularJS v1 / Angular v2 application.
*/
- bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef;
+ bootstrap(element: Element, modules?: any[], config?: ng.IAngularBootstrapConfig): UpgradeAdapterRef;
/**
* Allows Angular v2 service to be accessible from AngularJS v1.
*/
diff --git a/test/utils.ts b/test/utils.ts
index 244b9f5..9f90135 100644
--- a/test/utils.ts
+++ b/test/utils.ts
@@ -1,4 +1,3 @@
-import * as angular from 'angular';
import { isArray, isFunction, assign } from '../src/facade/lang';
// ============================
diff --git a/tsconfig.json b/tsconfig.json
index 6a44085..988aec8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,8 +8,17 @@
"emitDecoratorMetadata": true,
"declaration": true,
"pretty": true,
- "preserveConstEnums": true
+ "preserveConstEnums": true,
+ "moduleResolution": "node",
+ "lib": [
+ "es5",
+ "dom",
+ "es2015.promise"
+ ]
},
+ "include": [
+ "manual_typings/globals.d.ts"
+ ],
"exclude": [
"_book",
"playground",
diff --git a/typings.json b/typings.json
deleted file mode 100644
index 92572f6..0000000
--- a/typings.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "ng-metadata",
- "dependencies": {},
- "devDependencies": {},
- "globalDependencies": {
- "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#20e1eb9616922d382d918cc5a21870a9dbe255f5"
- },
- "globalDevDependencies": {
- "angular": "registry:dt/angular#1.5.0+20160412133217",
- "chai": "github:DefinitelyTyped/DefinitelyTyped/chai/chai.d.ts#1914a00b3c740348dae407ee0d2be89b0b58ad7f",
- "es6-shim": "registry:dt/es6-shim#0.31.2+20160602141504",
- "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8",
- "mocha": "github:DefinitelyTyped/DefinitelyTyped/mocha/mocha.d.ts#d6dd320291705694ba8e1a79497a908e9f5e6617",
- "sinon": "github:DefinitelyTyped/DefinitelyTyped/sinon/sinon.d.ts#6e7d83167d86d857817bd492786f8304f5c4a0e4"
- }
-}