Skip to content
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

Compilation errors Angular 16.1.1 (clean install) #876

Closed
DywiTom opened this issue Jun 19, 2023 · 10 comments
Closed

Compilation errors Angular 16.1.1 (clean install) #876

DywiTom opened this issue Jun 19, 2023 · 10 comments

Comments

@DywiTom
Copy link

DywiTom commented Jun 19, 2023

Describe the bug
I get compilation errors in angular 16.1.1 in a new/clean project.

To Reproduce

  • ng new test
  • npm install imask angular-imask
  • import into app.module.ts
  • ng serve
  • see in console:
All erros:

Error: node_modules/imask/esm/controls/html-contenteditable-mask-element.d.ts:5:9 - error TS2611: '_unsafeSelectionStart' is defined as a property in class 'HTMLMaskElement', but is overridden here in 'HTMLContenteditableMaskElement' as an accessor.

5 get _unsafeSelectionStart(): number;
~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/imask/esm/controls/html-contenteditable-mask-element.d.ts:7:9 - error TS2611: '_unsafeSelectionEnd' is defined as a property in class 'HTMLMaskElement',
but is overridden here in 'HTMLContenteditableMaskElement' as an accessor.

7 get _unsafeSelectionEnd(): number;
~~~~~~~~~~~~~~~~~~~

Error: node_modules/imask/esm/controls/html-contenteditable-mask-element.d.ts:11:9 - error TS2611: 'value' is defined as a property in class 'HTMLMaskElement', but is overridden here in 'HTMLContenteditableMaskElement' as an accessor.

11 get value(): string;
~~~~~

Error: node_modules/imask/esm/controls/html-input-mask-element.d.ts:9:9 - error TS2611: '_unsafeSelectionStart' is defined as a property in class 'HTMLMaskElement', but is overridden here in 'HTMLInputMaskElement' as an accessor.

9 get _unsafeSelectionStart(): number;
~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/imask/esm/controls/html-input-mask-element.d.ts:11:9 - error TS2611: '_unsafeSelectionEnd' is defined as a property in class 'HTMLMaskElement', but is overridden here in 'HTMLInputMaskElement' as an accessor.

11 get _unsafeSelectionEnd(): number;
~~~~~~~~~~~~~~~~~~~

Error: node_modules/imask/esm/controls/html-input-mask-element.d.ts:14:9 - error TS2611: 'value' is defined as a property in class 'HTMLMaskElement', but is overridden here
in 'HTMLInputMaskElement' as an accessor.

14 get value(): string;
~~~~~

Error: node_modules/imask/esm/masked/date.d.ts:14:56 - error TS2344: Type 'MaskedDate' does not satisfy the constraint 'MaskedPattern'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: MaskedDate, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: MaskedPattern, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: MaskedDate, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: MaskedPattern, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'MaskedPattern' is missing the following properties from type 'MaskedDate': pattern, isDateExist, date

14 static DEFAULTS: Partial<MaskedPatternOptions<any, MaskedDate, DateOptionsKeys>>;
~~~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/date.d.ts:30:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
'Value' could be instantiated with an arbitrary type which could be unrelated to 'Value | null'.

30 get date(): Value | null;
~~~~

Error: node_modules/imask/esm/masked/date.d.ts:32:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
'Value' could be instantiated with an arbitrary type which could be unrelated to 'Value | null'.

32 get typedValue(): Value | null;
~~~~~~~~~~

Error: node_modules/imask/esm/masked/date.d.ts:32:9 - error TS2416: Property 'typedValue' in type 'MaskedDate' is not assignable to the same property in base type 'MaskedPattern'.
Type 'Value | null' is not assignable to type 'Value'.
'Value' could be instantiated with an arbitrary type which could be unrelated to 'Value | null'.

32 get typedValue(): Value | null;
~~~~~~~~~~

Error: node_modules/imask/esm/masked/date.d.ts:33:9 - error TS2416: Property 'typedValue' in type 'MaskedDate' is not assignable to the same property in base type 'MaskedPattern'.
Type 'Value | null' is not assignable to type 'Value'.
'Value' could be instantiated with an arbitrary type which could be unrelated to 'Value | null'.

33 set typedValue(value: Value);
~~~~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:12:50 - error TS2344: Type 'MaskedDynamic' does not satisfy the constraint 'Masked'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: MaskedDynamic, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: MaskedDynamic, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is missing the following properties from type 'MaskedDynamic': compiledMasks, dispatch, _applyDispatch, currentMaskFlags, doDispatch

12 export type MaskedDynamicOptions = MaskedOptions<MaskedDynamic, 'dispatch'>;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:28:5 - error TS2416: Property 'updateOptions' in type 'MaskedDynamic' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedDynamic, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" |
"skipInvalid" | "dispatch">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedDynamic, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "dispatch">>>'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type 'DynamicMaskType | undefined'.

28 updateOptions(opts: Partial): void;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:29:5 - error TS2416: Property '_update' in type 'MaskedDynamic' is not assignable to the same property in base type
'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedDynamic, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" |
"skipInvalid" | "dispatch">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedDynamic, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "dispatch">>>'.

29 _update(opts: Partial): void;
~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:57:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
Type 'undefined' is not assignable to type 'boolean | "shift"'.

57 get overwrite(): boolean | 'shift' | undefined;
~~~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:57:9 - error TS2611: 'overwrite' is defined as a property in class 'Masked', but is overridden here in 'MaskedDynamic' as an accessor.

57 get overwrite(): boolean | 'shift' | undefined;
~~~~~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:59:9 - error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
Type 'undefined' is not assignable to type 'boolean | "append" | "remove"'.

59 get eager(): boolean | 'remove' | 'append' | undefined;
~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:59:9 - error TS2611: 'eager' is defined as a property in class 'Masked', but is overridden here in 'MaskedDynamic' as an accessor.

59 get eager(): boolean | 'remove' | 'append' | undefined;
~~~~~

Error: node_modules/imask/esm/masked/dynamic.d.ts:61:9 - error TS2611: 'skipInvalid' is defined as a property in class 'Masked', but is overridden here in 'MaskedDynamic' as an accessor.

61 get skipInvalid(): boolean | undefined;
~~~~~~~~~~~

Error: node_modules/imask/esm/masked/factory.d.ts:62:98 - error TS2344: Type 'Masked & Opts' does not satisfy the constraint 'Masked'.
Types of property 'prepare' are incompatible.
Type '(((chars: string, masked: Masked & Opts, flags: AppendFlags) => string | [string, ChangeDetails]) & ((chars: string, masked: MaskedRegExp, flags: AppendFlags<...>) => string | [...])) | ... 7 more ... | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '((chars: string, masked: Masked & Opts, flags: AppendFlags) => string | [string, ChangeDetails]) & ((chars: string, masked: MaskedRegExp, flags: AppendFlags<...>) => string | [...])' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '((chars: string, masked: Masked & Opts, flags: AppendFlags) => string | [string, ChangeDetails]) & ((chars: string, masked: MaskedRegExp, flags: AppendFlags<...>) => string | [...])' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is not assignable to type 'Masked & Opts'.
Type 'Masked' is not assignable to type 'Opts'.
'Masked' is assignable to the constraint of type 'Opts', but 'Opts' could be instantiated with a different subtype of constraint 'FactoryArg'.

62 export type NormalizedOpts = Opts extends Masked ? NormalizedMaskedOpts : Opts extends FactoryInstanceOpts ? NormalizedInstanceOpts : Opts extends FactoryStaticOpts | FactoryConstructorOpts ? Opts : {
~~~~

Error: node_modules/imask/esm/masked/function.d.ts:2:51 - error TS2344: Type 'MaskedFunction' does not satisfy the constraint 'Masked'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: MaskedFunction, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: MaskedFunction, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is not assignable to type 'MaskedFunction'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type '(value: string, masked: MaskedFunction) => boolean'.

2 export type MaskedFunctionOptions = MaskedOptions;
~~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/function.d.ts:6:5 - error TS2416: Property 'updateOptions' in type 'MaskedFunction' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedFunction, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedFunction, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type '((value: string, masked: MaskedFunction) => boolean) | undefined'.

6 updateOptions(opts: Partial): void;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/function.d.ts:7:5 - error TS2416: Property '_update' in type 'MaskedFunction' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedFunction, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedFunction, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>'.

7 _update(opts: Partial): void;
~~~~~~~

Error: node_modules/imask/esm/masked/number.d.ts:5:49 - error TS2344: Type 'MaskedNumber' does not satisfy the constraint 'Masked'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: MaskedNumber, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: MaskedNumber, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is missing the following properties from type 'MaskedNumber': radix, thousandsSeparator, mapToRadix, min, and 20 more.

5 export type MaskedNumberOptions = MaskedOptions<MaskedNumber, 'radix' | 'thousandsSeparator' | 'mapToRadix' | 'scale' | 'min' | 'max' | 'normalizeZeros' | 'padFractionalZeros'>;
~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/number.d.ts:35:5 - error TS2416: Property 'updateOptions' in type 'MaskedNumber' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedNumber, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "min" | ... 6 more ... | "padFractionalZeros">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedNumber, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" |
"overwrite" | "skipInvalid" | "min" | ... 6 more ... | "padFractionalZeros">>>'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type 'NumberConstructor | undefined'.

35 updateOptions(opts: Partial): void;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/number.d.ts:36:5 - error TS2416: Property '_update' in type 'MaskedNumber' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedNumber, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid" | "min" | ... 6 more ... | "padFractionalZeros">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedNumber, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" |
"overwrite" | "skipInvalid" | "min" | ... 6 more ... | "padFractionalZeros">>>'.

36 _update(opts: Partial): void;
~~~~~~~

Error: node_modules/imask/esm/masked/pattern.d.ts:11:152 - error TS2344: Type 'M' does not satisfy the constraint 'Masked'.
Type 'MaskedPattern' is not assignable to type 'Masked'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: M, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: M, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is not assignable to type 'M'.
'M' could be instantiated with an arbitrary type which could be unrelated to 'Masked'.

11 export type MaskedPatternOptions<Value = string, M extends MaskedPattern = MaskedPattern, Props extends keyof M = never> = MaskedOptions<M, 'definitions' |
'blocks' | 'placeholderChar' | 'displayChar' | 'lazy' | Props>;
~

Error: node_modules/imask/esm/masked/pattern.d.ts:50:5 - error TS2416: Property 'updateOptions' in type 'MaskedPattern' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedPattern, "lazy" | "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | ... 4 more ... | "displayChar">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedPattern, "lazy" | "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | ... 4 more ... | "displayChar">>>'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type 'string | undefined'.

50 updateOptions(opts: Partial<MaskedPatternOptions>): void;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/pattern.d.ts:51:5 - error TS2416: Property '_update' in type 'MaskedPattern' is not assignable to the same property in base type
'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedPattern, "lazy" | "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | ... 4 more ... | "displayChar">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedPattern, "lazy" | "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | ... 4 more ... | "displayChar">>>'.

51 _update(opts: Partial<MaskedPatternOptions>): void;
~~~~~~~

Error: node_modules/imask/esm/masked/pattern/input-definition.d.ts:11:33 - error TS2344: Type 'Opts' does not satisfy the constraint 'FactoryArg'.
Type 'Opts' is not assignable to type 'Masked'.

11 masked: FactoryReturnMasked['state'];
~~~~

node_modules/imask/esm/masked/pattern/input-definition.d.ts:10:41
10 export type PatternInputDefinitionState = MaskedState & {
~~~~
This type parameter might need an extends Masked<any> constraint.
node_modules/imask/esm/masked/pattern/input-definition.d.ts:10:41
10 export type PatternInputDefinitionState = MaskedState & {
~~~~
This type parameter might need an extends FactoryArg constraint.

Error: node_modules/imask/esm/masked/pipe.d.ts:9:131 - error TS2344: Type 'Opts' does not satisfy the constraint 'FactoryArg'.
Type 'Opts' is not assignable to type 'Masked'.

9 type TypedValueOf<Opts, Type> = Type extends (typeof PIPE_TYPE.MASKED | typeof PIPE_TYPE.UNMASKED) ? string : FactoryReturnMasked['typedValue'];
~~~~

node_modules/imask/esm/masked/pipe.d.ts:9:19
9 type TypedValueOf<Opts, Type> = Type extends (typeof PIPE_TYPE.MASKED | typeof PIPE_TYPE.UNMASKED) ? string : FactoryReturnMasked['typedValue'];
~~~~
This type parameter might need an extends Masked<any> constraint.
node_modules/imask/esm/masked/pipe.d.ts:9:19
9 type TypedValueOf<Opts, Type> = Type extends (typeof PIPE_TYPE.MASKED | typeof PIPE_TYPE.UNMASKED) ? string : FactoryReturnMasked['typedValue'];
~~~~
This type parameter might need an extends FactoryArg constraint.

Error: node_modules/imask/esm/masked/regexp.d.ts:2:49 - error TS2344: Type 'MaskedRegExp' does not satisfy the constraint 'Masked'.
Types of property 'prepare' are incompatible.
Type '((chars: string, masked: MaskedRegExp, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined' is not assignable to type '((chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]) | undefined'.
Type '(chars: string, masked: MaskedRegExp, flags: AppendFlags) => string | [string, ChangeDetails]' is not assignable to type '(chars: string, masked: Masked, flags: AppendFlags) => string | [string, ChangeDetails]'.
Types of parameters 'masked' and 'masked' are incompatible.
Type 'Masked' is not assignable to type 'MaskedRegExp'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type 'RegExp'.

2 export type MaskedRegExpOptions = MaskedOptions;
~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/regexp.d.ts:6:5 - error TS2416: Property 'updateOptions' in type 'MaskedRegExp' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedRegExp, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedRegExp, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" |
"overwrite" | "skipInvalid">>>'.
Types of property 'mask' are incompatible.
Type 'unknown' is not assignable to type 'RegExp | undefined'.

6 updateOptions(opts: Partial): void;
~~~~~~~~~~~~~

Error: node_modules/imask/esm/masked/regexp.d.ts:7:5 - error TS2416: Property '_update' in type 'MaskedRegExp' is not assignable to the same property in base type 'Masked'.
Type '(opts: Partial<Partial<Pick<MaskedRegExp, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void' is not assignable to type '(opts: Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>) => void'.
Types of parameters 'opts' and 'opts' are incompatible.
Type 'Partial<Partial<Pick<Masked, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "skipInvalid">>>' is not assignable to type 'Partial<Partial<Pick<MaskedRegExp, "eager" | "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" |
"overwrite" | "skipInvalid">>>'.

7 _update(opts: Partial): void;
~~~~~~~

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

× Failed to compile.

Environment:

  • OS: Windows
  • Browser Chrome
  • Version latest
  • IMask 7.0.0
  • angular-imask

package.json

{
  "name": "test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.1.1",
    "@angular/common": "^16.1.1",
    "@angular/compiler": "^16.1.1",
    "@angular/core": "^16.1.1",
    "@angular/forms": "^16.1.1",
    "@angular/platform-browser": "^16.1.1",
    "@angular/platform-browser-dynamic": "^16.1.1",
    "@angular/router": "^16.1.1",
    "angular-imask": "^7.0.0",
    "imask": "^7.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.1.0",
    "@angular/cli": "~16.1.0",
    "@angular/compiler-cli": "^16.1.1",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.9.4"
  }
}

@uNmAnNeR
Copy link
Owner

Seems like it's using ts v5 right? Some of the errors I just did not get at all and some were ignored intentionally.
I personally for instance do not understand what’s wrong if I replace a plain property with an accessor. It should work the same unless you want to do some magic which is out of scope of the lib. But why should I care?
My suggestion for now is just tell compiler to ignore type checking for this lib. And let’s see what we can do later when v5 will be a bit more stable.

@Delagen
Copy link

Delagen commented Jun 19, 2023

@uNmAnNeR under 4.9.5 and angular 15 also many errors, even i don't use angular-imask package.

Seems you need specify types only once, and remove types from dist folder or anyway separate them, may be simply remove types property from package.json

@uNmAnNeR
Copy link
Owner

@Delagen I do it the way i think it should work. Yes i break some rules but why not? Always doing that.
If you have any suggestions/improvements you are welcome.

@Delagen why do i have to remove types from dist folder? any reasons for that?

@Delagen
Copy link

Delagen commented Jun 19, 2023

Seems multiple specifing of types produces conflict. I think It will be enough removing of types property from package.json. I try to check it now. I will be back shortly

@Delagen
Copy link

Delagen commented Jun 19, 2023

Seems it's pretty simple.
Library doesn't compatible with strict mode and libCheck.
So setting of "skipLibCheck":true, "strict":false in tsconfig.json resolve issue. But why?

@DywiTom
Copy link
Author

DywiTom commented Jun 20, 2023

@uNmAnNeR i used typecript version 4.9.4 (see package.json) and i tried also latest one (5.1.3).
@Delagen skipLibCheck is not a solution, it's a workaround. it just skips the checks in the dependencies. in short:

In TypeScript, "skipLibCheck" is a compiler flag that allows you to skip type checking for declaration files (.d.ts) in your project. It helps speed up compilation time but increases the risk of type errors if the declaration files are flawed or outdated.

@Delagen
Copy link

Delagen commented Jun 20, 2023

@uNmAnNeR i used typecript version 4.9.4 (see package.json) and i tried also latest one (5.1.3).
@Delagen skipLibCheck is not a solution, it's a workaround. it just skips the checks in the dependencies. in short:

In TypeScript, "skipLibCheck" is a compiler flag that allows you to skip type checking for declaration files (.d.ts) in your project. It helps speed up compilation time but increases the risk of type errors if the declaration files are flawed or outdated.

I know what the flags do. But in tsconfig.json in your project it is as i noticed.
In my projects i use strict mode for many years, so it also not solution for me, i reverted to 6 version.

@DywiTom
Copy link
Author

DywiTom commented Jun 20, 2023

@Delagen it is not my project

@Delagen
Copy link

Delagen commented Jun 20, 2023

@Delagen it is not my project

My reply was not for you )

@uNmAnNeR
Copy link
Owner

I found several official excuses for myself.

Seems like the problem is only related to Angular. Other major frameworks have more trust in library authors (:
vuejs/vue-cli#5688

and also check comments here:
angular/angular-cli#16696

Of course skipLibCheck is not a solution in an ideal world but it's a rare case when libs strictly follow the framework release cycle.

For now i will not be rushing to upgrade to v5 soon. And i don't even think that all errors should be fixed. But i'll try to fix errors related to breaking LSP at least.

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