-
-
Notifications
You must be signed in to change notification settings - Fork 677
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
Support core-js/features/reflect
?
#1102
Comments
As you can see, TypeGraphQL only checks with a duck-typing approach if the Reflect polyfill is provided: type-graphql/src/metadata/utils.ts Lines 60 to 68 in 9555a94
So something must be wrong with your setup as TypeGraphQL does not require |
Thanks for the fast reply, @MichalLytek. It looks like the second test is triggering the failure with import 'core-js/features/reflect/';
console.log(typeof Reflect !== 'object' ); // false
console.log(typeof Reflect.decorate !== 'function'); // true
console.log(typeof Reflect.metadata !== 'function'); // false While |
Correct me if I'm wrong, but that's what TypeScript compiler requires in order to properly transpile decorators: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}; |
I don’t know enough about TypeScript internals to say but it does seem to be the case. However, the code snippet you quote includes a fall-back if the test for |
TypeGraphQL itself indeed does not call I don't know, maybe we can remove the check for |
Yes, having a runtime check to produce a friendly error message makes sense. I think that removing the check for |
Closing via 015939d 🔒 |
Is your feature request related to a problem? Please describe.
Our project uses the Reflect polyfill provided in
core-js
sincecore-js
provides a range of other useful polyfills. However, when we attempt to usetype-graphql
withcore-js/features/reflect
, we get the following error:ReflectMetadataMissingError: Looks like you've forgot to provide experimental metadata API polyfill. Please read the installation instruction for more details.
Describe the solution you'd like
Update the
type-graphql
check for a Reflect polyfill to support thecore-js
implementation as well asreflect-metadata
.The text was updated successfully, but these errors were encountered: