From ae0373d2cdaa9c6a525b195c41dd342c47175a60 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Sat, 29 Jul 2017 16:13:39 -0300 Subject: [PATCH] fix: typings entry point and failing definitions (#36) Also adds stricter ngc build rules to ensure correct metadata emit. --- packages/form/package.json | 1 + packages/form/source/connect-array.ts | 4 ++-- packages/form/source/shims.ts | 2 +- packages/form/tsconfig.json | 5 ++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/form/package.json b/packages/form/package.json index 06c331af..746c8dc8 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -69,6 +69,7 @@ "prepublish": "npm run build" }, "main": "dist/source/index.js", + "typings": "dist/source/index.d.ts", "repository": "https://github.com/angular-redux/form", "license": "MIT" } diff --git a/packages/form/source/connect-array.ts b/packages/form/source/connect-array.ts index dd960a5b..61c52be7 100644 --- a/packages/form/source/connect-array.ts +++ b/packages/form/source/connect-array.ts @@ -111,11 +111,11 @@ export class ConnectArray extends ControlContainer implements OnInit { return controlPath(this.key, this.parent); } - get validator(): ValidatorFn { + get validator(): ValidatorFn | null { return Validators.compose(this.rawValidators); } - get asyncValidator(): AsyncValidatorFn { + get asyncValidator(): AsyncValidatorFn | null { return Validators.composeAsync(this.rawAsyncValidators); } diff --git a/packages/form/source/shims.ts b/packages/form/source/shims.ts index 9fef323a..b61f5d23 100644 --- a/packages/form/source/shims.ts +++ b/packages/form/source/shims.ts @@ -10,7 +10,7 @@ import { } from '@angular/forms'; export function controlPath(name: string, parent: ControlContainer): string[] { - return [...parent.path, name]; + return [...(parent.path || []), name]; } export function selectValueAccessor( diff --git a/packages/form/tsconfig.json b/packages/form/tsconfig.json index a9317fd4..13d274dd 100644 --- a/packages/form/tsconfig.json +++ b/packages/form/tsconfig.json @@ -26,7 +26,10 @@ "useBabel": true, "useCache": false }, - "angularCompilerOptions": {}, + "angularCompilerOptions": { + "strictMetadataEmit": true, + "skipTemplateCodegen": true + }, "exclude": [ "node_modules", "dist",