Skip to content

Add strictNullChecks && noUnusedParameters support #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulsouche opened this issue Sep 12, 2017 · 7 comments
Closed

Add strictNullChecks && noUnusedParameters support #497

paulsouche opened this issue Sep 12, 2017 · 7 comments

Comments

@paulsouche
Copy link
Contributor

Hi,

Transpiling with strictNullChecks && noUnusedParameters does not work...

Is it planned to support this ? Is there a milestone open ?

Thx anyway for the great job

Errors

ERROR in ./node_modules/@ng2-dynamic-forms/ui-bootstrap/src/dynamic-bootstrap-form-control.component.ts
(53,5): error TS2322: Type 'null' is not assignable to type 'DynamicFormArrayGroupModel'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(67,42): error TS2345: Argument of type 'DynamicValidatorsMap | null | undefined' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'undefined' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(69,74): error TS2345: Argument of type 'DynamicFormArrayGroupModel' is not assignable to parameter of type 'DynamicPathable | undefined'.
  Type 'DynamicFormArrayGroupModel' is not assignable to type 'DynamicPathable'.
    Types of property 'index' are incompatible.
      Type 'number | null' is not assignable to type 'number | undefined'.
        Type 'null' is not assignable to type 'number | undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(74,49): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'null' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(75,54): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'null' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(82,21): error TS2322: Type 'null' is not assignable to type 'DynamicPathable'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(99,46): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'null' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(101,89): error TS2345: Argument of type 'DynamicFormGroupModel' is not assignable to parameter of type 'DynamicPathable | undefined'.
  Type 'DynamicFormGroupModel' is not assignable to type 'DynamicPathable'.
    Types of property 'parent' are incompatible.
      Type 'DynamicPathable | null' is not assignable to type 'DynamicPathable'.
        Type 'null' is not assignable to type 'DynamicPathable'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(112,77): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'null' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(113,87): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type 'DynamicValidatorsMap'.
  Type 'null' is not assignable to type 'DynamicValidatorsMap'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(125,25): error TS2339: Property 'toString' does not exist on type 'number | (undefined & null) | (undefined & number) | (number & null)'.
  Property 'toString' does not exist on type 'undefined & null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(182,66): error TS2345: Argument of type 'DynamicFormGroupModel | null' is not assignable to parameter of type 'DynamicPathable | undefined'.
  Type 'null' is not assignable to type 'DynamicPathable | undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(221,69): error TS2345: Argument of type 'DynamicFormArrayGroupModel' is not assignable to parameter of type 'DynamicPathable | undefined'.
  Type 'DynamicFormArrayGroupModel' is not assignable to type 'DynamicPathable'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(229,78): error TS2345: Argument of type 'DynamicFormArrayGroupModel' is not assignable to parameter of type 'DynamicPathable | undefined'.
  Type 'DynamicFormArrayGroupModel' is not assignable to type 'DynamicPathable'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form.service.ts
(327,58): error TS2345: Argument of type 'DynamicFormArrayModel' is not assignable to parameter of type 'DynamicFormArrayModelConfig'.
  Types of property 'asyncValidator' are incompatible.
    Type 'DynamicValidatorsMap | null' is not assignable to type 'DynamicValidatorsMap | undefined'.
      Type 'null' is not assignable to type 'DynamicValidatorsMap | undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/timepicker/dynamic-timepicker.model.ts
(25,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/timepicker/dynamic-timepicker.model.ts
(26,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/textarea/dynamic-textarea.model.ts
(30,9): error TS2322: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/textarea/dynamic-textarea.model.ts
(31,9): error TS2322: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/slider/dynamic-slider.model.ts
(29,9): error TS2322: Type 'number | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/slider/dynamic-slider.model.ts
(30,9): error TS2322: Type 'number | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/slider/dynamic-slider.model.ts
(31,9): error TS2322: Type 'number | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/slider/dynamic-slider.model.ts
(32,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/select/dynamic-select.model.ts
(27,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/select/dynamic-select.model.ts
(28,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/rating/dynamic-rating.model.ts
(23,9): error TS2322: Type 'number | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/file-upload/dynamic-file-upload.model.ts
(36,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/file-upload/dynamic-file-upload.model.ts
(37,9): error TS2322: Type 'number | null | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/file-upload/dynamic-file-upload.model.ts
(38,9): error TS2322: Type 'number | null | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/file-upload/dynamic-file-upload.model.ts
(40,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/datepicker/dynamic-datepicker.model.ts
(28,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/datepicker/dynamic-datepicker.model.ts
(29,9): error TS2322: Type 'string | null | undefined' is not assignable to type 'string | null'.
  Type 'undefined' is not assignable to type 'string | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/checkbox/dynamic-checkbox.model.ts
(23,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-option-control.model.ts
(24,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-option-control.model.ts
(30,9): error TS2322: Type 'string | null' is not assignable to type 'string'.
  Type 'null' is not assignable to type 'string'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-file-control.model.ts
(19,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(42,13): error TS2322: Type 'ValidatorFn | AsyncValidatorFn | undefined' is not assignable to type 'ValidatorFn | AsyncValidatorFn | ValidatorFactory | null'.
  Type 'undefined' is not assignable to type 'ValidatorFn | AsyncValidatorFn | ValidatorFactory | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(53,9): error TS2322: Type 'ValidatorFn | AsyncValidatorFn | ValidatorFactory | null' is not assignable to type 'ValidatorFn | AsyncValidatorFn'.
  Type 'null' is not assignable to type 'ValidatorFn | AsyncValidatorFn'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(90,55): error TS6133: 'match' is declared but never used.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(190,21): error TS2531: Object is possibly 'null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(193,36): error TS2531: Object is possibly 'null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(201,42): error TS2345: Argument of type 'DynamicValidatorsMap | null' is not assignable to parameter of type '{}'.
  Type 'null' is not assignable to type '{}'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(203,17): error TS2531: Object is possibly 'null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/service/dynamic-form-validation.service.ts
(205,32): error TS2531: Object is possibly 'null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/utils/relation.utils.ts
(16,9): error TS2322: Type 'DynamicFormControlRelationGroup | undefined' is not assignable to type 'DynamicFormControlRelationGroup'.
  Type 'undefined' is not assignable to type 'DynamicFormControlRelationGroup'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-input-control.model.ts
(37,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-input-control.model.ts
(38,9): error TS2322: Type 'number | null | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-input-control.model.ts
(39,9): error TS2322: Type 'number | null | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-input-control.model.ts
(42,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-input-control.model.ts
(43,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/input/dynamic-input.model.ts
(63,9): error TS2322: Type 'string | number | Date | null | undefined' is not assignable to type 'string | number | Date | null'.
  Type 'undefined' is not assignable to type 'string | number | Date | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/input/dynamic-input.model.ts
(64,9): error TS2322: Type 'string | number | Date | null | undefined' is not assignable to type 'string | number | Date | null'.
  Type 'undefined' is not assignable to type 'string | number | Date | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/input/dynamic-input.model.ts
(65,9): error TS2322: Type 'boolean | null | undefined' is not assignable to type 'boolean | null'.
  Type 'undefined' is not assignable to type 'boolean | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/input/dynamic-input.model.ts
(67,9): error TS2322: Type 'number | null | undefined' is not assignable to type 'number | null'.
  Type 'undefined' is not assignable to type 'number | null'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/form-array/dynamic-form-array.model.ts
(11,14): error TS2420: Class 'DynamicFormArrayGroupModel' incorrectly implements interface 'DynamicPathable'.
  Types of property 'index' are incompatible.
    Type 'number | null' is not assignable to type 'number | undefined'.
      Type 'null' is not assignable to type 'number | undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/form-array/dynamic-form-array.model.ts
(18,88): error TS2322: Type 'null' is not assignable to type 'number'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/form-array/dynamic-form-array.model.ts
(76,9): error TS2322: Type '(() => DynamicFormControlModel[]) | undefined' is not assignable to type '() => DynamicFormControlModel[]'.
  Type 'undefined' is not assignable to type '() => DynamicFormControlModel[]'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/form-array/dynamic-form-array.model.ts
(79,9): error TS2322: Type 'number | undefined' is not assignable to type 'number'.
  Type 'undefined' is not assignable to type 'number'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/utils/core.utils.ts
(40,42): error TS2533: Object is possibly 'null' or 'undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/utils/core.utils.ts
(43,71): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/utils/core.utils.ts
(59,53): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/utils/core.utils.ts
(95,29): error TS6133: 'key' is declared but never used.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-form-value-control.model.ts
(39,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-form-value-control.model.ts
(53,9): error TS2322: Type 'T | null' is not assignable to type 'T'.
  Type 'null' is not assignable to type 'T'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-form-control.model.ts
(62,23): error TS2420: Class 'DynamicFormControlModel' incorrectly implements interface 'DynamicPathable'.
  Types of property 'parent' are incompatible.
    Type 'DynamicPathable | null' is not assignable to type 'DynamicPathable'.
      Type 'null' is not assignable to type 'DynamicPathable'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-form-control.model.ts
(85,9): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
  Type 'undefined' is not assignable to type 'boolean'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-form-control.model.ts
(87,9): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/component/dynamic-form-control.component.ts
(261,20): error TS6133: '$event' is declared but never used.
@udos86
Copy link
Owner

udos86 commented Sep 12, 2017

@paulsouche Hi & Merci for your proposal!

I'll deliver a pull request as soon as possible for this.

@paulsouche
Copy link
Contributor Author

paulsouche commented Sep 14, 2017

@udos86 Hi & thx a lot for your fast commit

strictNullChecks & noUnusedParameters are OK but still having 3 (new ?) errors on noUnusedLocals

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/datepicker/dynamic-datepicker.model.ts
(3,10): error TS6133: 'Utils' is declared but never used.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/checkbox/dynamic-checkbox.model.ts
(4,10): error TS6133: 'Utils' is declared but never used.

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/dynamic-file-control.model.ts
(4,10): error TS6133: 'Utils' is declared but never used.

BTW you should maybe use declarations files d.ts to export your typings as your clients can use skipLibCheck

@udos86
Copy link
Owner

udos86 commented Sep 14, 2017

@paulsouche Thanks, I fixed those three errors in new 1.4.31.

BTW you should maybe use declarations files d.ts to export your typings as your clients can use

Mmh, I'm already delivering *.d.ts files in the npm packages. Am I missing something here?

@paulsouche
Copy link
Contributor Author

paulsouche commented Sep 14, 2017

Wow that was fast !

You're delivering both .ts and .d.ts files

image

If there was only d.ts files skipLibCheck should work even if there is a non used local. But if you look error above

ERROR in ./node_modules/@ng2-dynamic-forms/core/src/model/datepicker/dynamic-datepicker.model.ts
(3,10): error TS6133: 'Utils' is declared but never used.

It comes from a .ts file.

That's strange because your typings key in package.json looks correct. Maybe a TypeScript issue mixing .ts and .d.ts files. I'll have a look.

EDIT

Found it microsoft/TypeScript#15363

@udos86
Copy link
Owner

udos86 commented Sep 14, 2017

@paulsouche Merci beaucoup!

I always considered it a good practice to publish TypeScript source code especially for providing a good debugging experience via SystemJS.

@arpitrajpurohit
Copy link

@paulsouche

Hey Paul, I am getting the same error . How did you resolve this?

@paulsouche
Copy link
Contributor Author

paulsouche commented Nov 8, 2017

@arpitrajpurohit which version are you using ? Work fine for me in 5.0.0

Basically I have a tsconfig.json with strict: true for my src and a tsconfig-aot.json with less strict checks like skipLibCheck: true or strictNullChecks: false depending on the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants