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
fix: allow propertyKey
to be undefined
#226
fix: allow propertyKey
to be undefined
#226
Conversation
any updates on this? Only this is the hinderence while migrating to TS 5😢😢 |
asked someone from MS to look into it. hopefully they will approve this soon. |
Guys, this needs to be merged asap, the project becomes unusable. |
We might want to tag someone from MS I guess.. |
@Xapphire13 Hello! |
LGTM I don't love the idea of |
Thanks @MeltingMosaic ! Do you know when a new version will be released? :) |
@MeltingMosaic Do you know when will this be released? |
still waiting⌚ |
For people interested, in the meantime I'm using a patch using diff --git a/node_modules/tsyringe/dist/typings/decorators/inject-all-with-transform.d.ts b/node_modules/tsyringe/dist/typings/decorators/inject-all-with-transform.d.ts
index 196dfac..1a5764e 100644
--- a/node_modules/tsyringe/dist/typings/decorators/inject-all-with-transform.d.ts
+++ b/node_modules/tsyringe/dist/typings/decorators/inject-all-with-transform.d.ts
@@ -5,5 +5,5 @@ import Transform from "../types/transform";
*
* @return {Function} The parameter decorator
*/
-declare function injectAllWithTransform(token: InjectionToken<any>, transformer: InjectionToken<Transform<[any], any>>, ...args: any[]): (target: any, propertyKey: string | symbol, parameterIndex: number) => any;
+declare function injectAllWithTransform(token: InjectionToken<any>, transformer: InjectionToken<Transform<[any], any>>, ...args: any[]): (target: any, propertyKey: string | symbol | undefined, parameterIndex: number) => any;
export default injectAllWithTransform;
diff --git a/node_modules/tsyringe/dist/typings/decorators/inject-all.d.ts b/node_modules/tsyringe/dist/typings/decorators/inject-all.d.ts
index 2bd7da4..3716ef5 100644
--- a/node_modules/tsyringe/dist/typings/decorators/inject-all.d.ts
+++ b/node_modules/tsyringe/dist/typings/decorators/inject-all.d.ts
@@ -4,5 +4,5 @@ import InjectionToken from "../providers/injection-token";
*
* @return {Function} The parameter decorator
*/
-declare function injectAll(token: InjectionToken<any>): (target: any, propertyKey: string | symbol, parameterIndex: number) => any;
+declare function injectAll(token: InjectionToken<any>): (target: any, propertyKey: string | symbol | undefined, parameterIndex: number) => any;
export default injectAll;
diff --git a/node_modules/tsyringe/dist/typings/decorators/inject-with-transform.d.ts b/node_modules/tsyringe/dist/typings/decorators/inject-with-transform.d.ts
index 05f87d7..47ba138 100644
--- a/node_modules/tsyringe/dist/typings/decorators/inject-with-transform.d.ts
+++ b/node_modules/tsyringe/dist/typings/decorators/inject-with-transform.d.ts
@@ -7,5 +7,5 @@ import Transform from "../types/transform";
* @param args Arguments to be passed to the transform method on the transformer
* @returns The parameter decorator
*/
-declare function injectWithTransform(token: InjectionToken<any>, transformer: InjectionToken<Transform<any, any>>, ...args: any[]): (target: any, propertyKey: string | symbol, parameterIndex: number) => any;
+declare function injectWithTransform(token: InjectionToken<any>, transformer: InjectionToken<Transform<any, any>>, ...args: any[]): (target: any, propertyKey: string | symbol | undefined, parameterIndex: number) => any;
export default injectWithTransform;
diff --git a/node_modules/tsyringe/dist/typings/decorators/inject.d.ts b/node_modules/tsyringe/dist/typings/decorators/inject.d.ts
index 5d48d79..867384c 100644
--- a/node_modules/tsyringe/dist/typings/decorators/inject.d.ts
+++ b/node_modules/tsyringe/dist/typings/decorators/inject.d.ts
@@ -4,5 +4,5 @@ import InjectionToken from "../providers/injection-token";
*
* @return {Function} The parameter decorator
*/
-declare function inject(token: InjectionToken<any>): (target: any, propertyKey: string | symbol, parameterIndex: number) => any;
+declare function inject(token: InjectionToken<any>): (target: any, propertyKey: string | symbol | undefined, parameterIndex: number) => any;
export default inject;
diff --git a/node_modules/tsyringe/dist/typings/reflection-helpers.d.ts b/node_modules/tsyringe/dist/typings/reflection-helpers.d.ts
index 2591a35..4c45940 100644
--- a/node_modules/tsyringe/dist/typings/reflection-helpers.d.ts
+++ b/node_modules/tsyringe/dist/typings/reflection-helpers.d.ts
@@ -7,4 +7,4 @@ export declare function getParamInfo(target: constructor<any>): ParamInfo[];
export declare function defineInjectionTokenMetadata(data: any, transform?: {
transformToken: InjectionToken<Transform<any, any>>;
args: any[];
-}): (target: any, propertyKey: string | symbol, parameterIndex: number) => any;
+}): (target: any, propertyKey: string | symbol | undefined, parameterIndex: number) => any; |
I see that this PR was merged, do you know when the package.json version will be updated and a release will be published? Thanks |
Hi, Someone can release a new tag (v4.8.0 maybe) ? This unrelease change block many people to migrate with TS 5. |
I agree that a new release would be good, but the workaround in #225 (comment) works fine in the meantime. |
It unfortunately does not work for me, as Deno is weirder with modules than Node. Please release the fix. |
In case it's useful to anybody else, I have a fork of this repo with this fix included (and compiled files checked in, so it can be used as an npm dependency): https://github.com/tec27/tsyringe You can use it by changing your package.json dep to: "tsyringe": "tec27/tsyringe#43d00160db294312db4c7deb38046f71dcd74348" |
Had to fork tsyringe to get the latest changes for the time being, this can be undone once microsoft/tsyringe#226 is in a published version. Prettier and/or our import sorter also seemingly changed and wanted to reorder capital letters so that is the majority of the changes here.
Thanks @JorgeLNJunior for this fix. It works like a charm for me! |
Description
Typescript 5 fixed a bug in the decorator parameter type check that was causing decorators from tsyringe to fail to build. This fix allows for the
propertyKey
parameter to be undefined.I'm not an experienced programmer, so if there's something wrong, please let me know.
Fixes: #221