ClientSideFetchXmlObjectLibraries icon indicating copy to clipboard operation
ClientSideFetchXmlObjectLibraries copied to clipboard

unable to load file with --strictNullChecks enabled

Open aappddeevv opened this issue 8 years ago • 3 comments

The code will generate many errors related to null checking.

aappddeevv avatar Oct 01 '17 17:10 aappddeevv

Seems that --strictNullChecks was in TypeScript 2.0. That was after this was written. I am not familiar with it. The libraries (both JS & TS) have pretty aggressive type checking built-in. What do you suggest? I am happy to accept contributions to this project.

JimDaly avatar Oct 01 '17 21:10 JimDaly

The flag says that you cannot have null/undefined assigned to an object property. You have to either model it explicitly or use another way to handle it. I think you had a large number of null checks from your Utils so its clear that you are trying to handle defaulting and you could just use defaults while ensuring that the toXml functions are properly adjusted. I hacked a version that compiles but I've not tested it on some queries. You can't turn off the flag for just one file and since its not in npm, it's always loaded as a local file that obeys the flags.

I'll pass along the hacked version, which is not the way you want to handle this flag, once I've tested it a bit more which should be just a day or two.

The file cannot be imported as-is with this flag turned on.

aappddeevv avatar Oct 02 '17 15:10 aappddeevv

I think it could be rewritten to model nulls explicitly, use enums (string enums), sum types (e.g. operator) and still compile down to usable js so you don't have to maintain two versions.

aappddeevv avatar Oct 05 '17 01:10 aappddeevv