Closed devuo closed 2 weeks ago
@devuo Hi, thanks for reporting
There's been a bit of infrastructure added to the project on 0.33.20. Will investigate and report back.
@devuo Hi, thanks again for reporting.
I have published a hotfix on 0.33.21. The issue was related to a variable named Object
shadowing the globalThis.Object
(I seem to keep running into this problem unfortunately). The variable has been prefixed with _Object
inline with code elsewhere.
Apologies for the inconvenience (I really do need better CJS testing)
If you're interested, the new infrastructure that's gone in relates to being able to parse TypeScript syntax directly into TB types (instead of using Type.*). You can test with the following.
const { Parse } = require('@sinclair/typebox')
const A = Parse(`{ x: number, y: number }`)
console.log(A)
The feature is published in an Experimental state currently, but will be expanded upon in 0.34.x. The feature is currently pending documentation, but you can experiment at the link below, I'm currently looking for community feedback on the feature, so open to community insights, bug reports, feature requests to consider for the next main revision.
Thanks again for reporting the issue Cheers! S
Affected version
0.33.20
Description
After updating to typebox version 0.33.20 CommonJS based package failed to start with the following error:
ReferenceError: Cannot access 'Object' before initialization
.This error does not happen with ESM based packages.
Steps to reproduce
🔴 CommonJS (Fails):
🟢 ESM (Works):
Stack trace