Uh oh!
There was an error while loading. Please reload this page.
feat(53461): Implement decorator metadata proposal - #54657
Conversation
Jake Bailey (jakebailey)
commented
Jun 16, 2023
Ron Buckton (rbuckton)
left a comment
There was a problem hiding this comment.
We need to add Symbol.metadata to the libs, probably under lib/esnext.decorators.d.ts
In lib/decorators.d.ts we can make context.metadata conditional using an approach like this:
// lib.esnext.decorators.d.tsinterfaceSymbol{readonlymetadata: unique symbol;}// lib.decorators.d.ts
...
typeDecoratorMetadata=typeofglobalThisextends{Symbol: {readonlymetadata: symbol}} ? object : object|undefined;interfaceClassDecoratorContext<...>{
...
readonlymetadata: DecoratorMetadat;
...
}
...
interfaceClassMethodDecoratorContext<...>{
...
readonlymetadata: DecoratorMetadat;
...
}
... etc. ...Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ron Buckton (rbuckton)
commented
Jun 21, 2023
Ideally, we can take this for the 5.2 beta which has a deadline of this Friday. Let me know if you need me to help with any part of this PR to get it in this week. |
Oleksandr Tarasiuk (a-tarasyuk)
commented
Jun 21, 2023
Ron Buckton (@rbuckton) Thank you so much for taking the time to review this PR 👍🏻. I have added the |
Ron Buckton (rbuckton)
left a comment
There was a problem hiding this comment.
It would also help to have evaluation tests that run the some of the examples used in the esDecoratorMetadata tests and verify the expected output (see src\testRunner\unittests\evaluation\esDecorators.ts).
To make that work you would need to shim Symbol.metadata for the evaluation tests, which you can do in src\harness\evaluatorImpl.ts:20. See
https://github.com/microsoft/TypeScript/pull/54505/files?show-viewed-files=true&file-filters%5B%5D=#diff-3b6817a4cdcf825c75e6f9af6cad21356ee6a7cd35bb5d3c92eef8e0985ce910R20-R33 for an example.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…uards to avoid crashes caused by incorrect base prototypes
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ron Buckton (rbuckton)
commented
Jun 22, 2023
Some tests are failing and there are merge conflicts. Can you verify baselines and update with main? |
Oleksandr Tarasiuk (a-tarasyuk)
commented
Jun 22, 2023
Ron Buckton (@rbuckton) I've merged changes from the |
Ron Buckton (rbuckton)
commented
Jun 22, 2023
It looks like one of your evaluation tests is failing. |
Ron Buckton (rbuckton)
commented
Jun 22, 2023
TypeScript Bot (@typescript-bot) pack this |
Heya Ron Buckton (@rbuckton), I've started to run the tarball bundle task on this PR at 3515e58. You can monitor the build here. |
Oleksandr Tarasiuk (a-tarasyuk)
commented
Jun 22, 2023
Yes. It due to #54657 (comment) |
Hey Ron Buckton (@rbuckton), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
interfaceFunction{[Symbol.metadata]?: object|null;}Sorry, we should add it to src/lib/decorators.d.ts instead, per my other suggestion. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ron Buckton (rbuckton)
commented
Jun 23, 2023
This is looking fairly close to ready, once the baselines are reviewed and accepted I'll hopefully be able to take a final pass and approve. |
Ron Buckton (@rbuckton) What are your thoughts on moving the following types from interfaceFunction{[Symbol.metadata]: DecoratorMetadata|null;} |
Ron Buckton (rbuckton)
commented
Jun 23, 2023
It shouldn't be optional since it will already get the |
Oleksandr Tarasiuk (a-tarasyuk)
commented
Jun 23, 2023
oke, I've moved it to |
Ron Buckton (rbuckton)
commented
Jun 23, 2023
I should have added more detail to this, but it was late. The main reason to not make it an optional property of typeFunctionMetadata=typeofglobalThisextends{Symbol: {readonlymetadata: symbol}} ? {[Symbol.metadata]: DecoratorMetadataObject|null;} : {[Symbol.metadata]?: DecoratorMetadataObject|null;};interfaceFunctionextendsFunctionMetadata{}But I think the approach of just using |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#53461