You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
When strict mode is turned on in tsconfig.json compiler options, angular should be able to build successfully.
What is the current behavior?
Fails to build angular
ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15): error TS2416: Property '_registry' in type 'MockMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, MockMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'MockMediaQueryList' is not assignable to type 'MediaQueryList'.
Types of property 'removeListener' are incompatible.
Type '(_: EventListener | EventListenerObject | null) => void' is not assignable to type '(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) => void'.
Types of parameters '_' and 'listener' are incompatible.
Type '((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener'.
Types of parameters 'ev' and 'evt' are incompatible.
Type 'Event' is missing the following properties from type 'MediaQueryListEvent': matches, media
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(82,5): error TS2416: Property 'removeListener' in type 'MockMediaQueryList' is not assignable to the same property in base type 'MediaQueryList'.
Type '(_: EventListener | EventListenerObject | null) => void' is not
assignable to type '(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) => void'.
Types of parameters '_' and 'listener' are incompatible.
Type '((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any'
is not assignable to type 'EventListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(28,5): error TS2416: Property 'removeListener' in type 'ServerMediaQueryList' is not assignable to the same property in base type 'MediaQueryList'.
Type '(_: EventListener | EventListenerObject | null) => void' is not
assignable to type '(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) => void'.
Types of parameters '_' and 'listener' are incompatible.
Type '((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any'
is not assignable to type 'EventListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(44,15): error TS2416: Property '_registry' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, ServerMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'ServerMediaQueryList' is not assignable to type 'MediaQueryList'.
Types of property 'removeListener' are incompatible.
Type '(_: EventListener | EventListenerObject | null) => void' is not assignable to type '(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) => void'.
Types of parameters '_' and 'listener' are incompatible.
Type '((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener | EventListenerObject | null'.
Type '(this: MediaQueryList, ev: MediaQueryListEvent) => any' is not assignable to type 'EventListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(54,15): error TS2416: Property '_buildMQL' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type '(query: string) => ServerMediaQueryList' is not assignable to type '(query: string) => MediaQueryList'.
Type 'ServerMediaQueryList' is not assignable to type 'MediaQueryList'.
What are the steps to reproduce?
Create a new project ng new test123 with angular-cli v7.2.1
Install flex-layout npm i -S @angular/flex-layout
Install angular material, cdk only is ok too ng add @angular/material
By the way, ordinarily this wouldn't be an issue, but TypeScript has been having an identity crisis in regards to how they type the DOM. And since we are tied very directly to the DOM's definition of matchMedia, things like this represent breaking changes. Ordinarily, version bumps of TypeScript shouldn't result in errors like this.
CaerusKaru
changed the title
Angular fails to build when using strict mode
Flex Layout not compatible with TypeScript 3.2
Jan 10, 2019
Bug Report
What is the expected behavior?
When strict mode is turned on in tsconfig.json compiler options, angular should be able to build successfully.
What is the current behavior?
Fails to build angular
What are the steps to reproduce?
ng new test123
with angular-cli v7.2.1npm i -S @angular/flex-layout
ng add @angular/material
"strict": true
to tsconfig.jsonng build
What is the use-case or motivation for changing an existing behavior?
strict mode helps catch user errors and I use it in my project, this should compile the library properly
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
There are several related issues and these are all resolved, however only when not using strict mode. With strict mode, it fails to compile.
#971
#861
#973
#851
The text was updated successfully, but these errors were encountered: