Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a /no-conflict export that does not mutate the global Reflect object #131

Closed
wants to merge 3 commits into from

Conversation

rbuckton
Copy link
Owner

This adds a reflect-metadata/no-conflict module that can be imported rather than relying on mutation of the global Reflect object.

This can be used with TypeScript's __metadata helper when not using --importHelpers, but requires a local definition of Reflect when emitting to CommonJS/AMD/UMD/System:

// --module es2015
// --module es2020
// --module esnext
import { Reflect } from "reflect-metadata/no-conflict";
...
// --module commonjs
// --module amd
// --module umd
// --module system
import { Reflect as _Reflect } from "reflect-metadata/no-conflict";
const Reflect = _Reflect;

// which, for 'commonjs', is transformed to:
const no_conflict_1 = require("reflect-metadata/no-conflict");
const Reflect = no_conflict_1.Reflect;

Support for --importHelpers requires a custom tslib, which is out of scope for this PR.

Fixes #130

@erights
Copy link

erights commented Jun 9, 2021

This PR looks ready to review and is green under CI. Should it have reviewers?

@rbuckton
Copy link
Owner Author

rbuckton commented Dec 7, 2023

Closing in favor of #144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importable version of reflect-metadata that does not shim globals.
2 participants