-
Notifications
You must be signed in to change notification settings - Fork 18
Description
In response to the following TypeScript warning received when compiling my Angular/Breeze SPA
TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. For more information, see https://angular.io/guide/build#configuring-browser-compatibility NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
I updated the target property in my tsconfig.base.json file and the warning went away. Breeze seemed to be functioning normally for retrieving data so I assumed all was well, until I tried to save something and what used to take a second or less suddenly started hanging. With my developer console in Edge open, I paused JavaScript execution and examined the call stack and found an infinite call loop was occurring:
toJSONSafe (breeze-client.js:362) (anonymous) (breeze-client.js:354) toJSONSafe (breeze-client.js:353) toJSONSafe (breeze-client.js:371) toJSONSafe (breeze-client.js:371) toJSONSafe (breeze-client.js:371) (anonymous) (breeze-client.js:354) toJSONSafe (breeze-client.js:353) toJSONSafe (breeze-client.js:371) toJSONSafe (breeze-client.js:371) (anonymous) (breeze-client.js:354)
When I switch my target back to ES2018, which is what I was using previously, the problem totally goes away and saveChanges() works perfectly.
My complete tsconfig.base.ts file contains the following:
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "module": "esnext", "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "typeRoots": [ "node_modules/@types" ], "lib": [ "ES2022", "dom" ] }, "angularCompilerOptions": { "fullTemplateTypeCheck": false, "strictInjectionParameters": true } }
Are there any other settings that should be adjusted to make the infinite recursive looping go away when targeting ES2022 or is this a real breeze-client issue?
I am using "breeze-client": "^2.1.5" loaded by npm from my package.json file.