dbfannin / ngx-logger

Angular logger
MIT License
428 stars 110 forks source link

Cannot build while using ngx-logger and the typescript flag 'exactOptionalPropertyTypes' #306

Closed BenjaminHutchinson closed 1 year ago

BenjaminHutchinson commented 2 years ago

Hi,

I am currently unable to build my project while using your library and having turned on the typescript flag 'exactOptionalPropertyTypes'. I believe there is an out of date dependency but I am confused as to how this is occuring as the dependencies on your project are dev dependencies which should avoid bringing in the old angular version.

https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes

I'd raised an angular issue (https://github.com/angular/angular/issues/46148) before narrowing it down to explicitly including your library.

Reproduction: https://stackblitz.com/edit/node-kmwkew

This issue was from an older angular version and is fixed in any angular version 13.1.X onwards I believe.

Original angular issue for the problem: https://github.com/angular/angular/issues/44157

The error:

Error: node_modules/@angular/compiler/src/render3/view/template.d.ts:229:22 - error TS2420: Class 'BindingScope' incorrectly implements interface 'LocalResolver'. Types of property 'globals' are incompatible. Type 'Set | undefined' is not assignable to type 'Set'. Type 'undefined' is not assignable to type 'Set'.

229 export declare class BindingScope implements LocalResolver {

bmtheo commented 2 years ago

We are not building with the same level of strictness

To avoid this you should set "skipLibCheck" to true in your tsconfig

I forked your repo to try it out and it works (until another error that is not related to this issue) https://stackblitz.com/edit/node-vb5sg3?file=tsconfig.json