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

Maintenance: test repo & packages with TypeScript 5.x #1375

Closed
1 of 2 tasks
dreamorosi opened this issue Mar 17, 2023 · 4 comments · Fixed by #1672
Closed
1 of 2 tasks

Maintenance: test repo & packages with TypeScript 5.x #1375

dreamorosi opened this issue Mar 17, 2023 · 4 comments · Fixed by #1672
Assignees
Labels
completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Milestone

Comments

@dreamorosi
Copy link
Contributor

Summary

On March 16th TypeScript 5.0 was released. Among other things, the release has some changes related to decorators support.

We should invest some time to test the project with the new version, understand if there's any implication, and if any change is required.

Why is this needed?

We can expect customers will want to start using the new TS version and so we need to test compatibility.

Which area does this relate to?

Other

Solution

No response

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@dreamorosi dreamorosi added triage This item has not been triaged by a maintainer, please wait internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels Mar 17, 2023
@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation and removed triage This item has not been triaged by a maintainer, please wait labels Mar 17, 2023
@dreamorosi
Copy link
Contributor Author

dreamorosi commented Apr 5, 2023

After some initial research, it appears that the signature/type of how decorators are defined in TS has changed with the new version. This is unfortunate but also not surprising since decorators as a feature in TypeScript/JavaScript are still experimental.

Prior to TS5.0, the signature was this:

type MethodDecorator = <T>(
  target: Object,
  propertyKey: string | symbol,
  descriptor: TypedPropertyDescriptor<T>
) => TypedPropertyDescriptor<T> | void;

Now, with TS5.0, the signature looks like this:

type ClassMethodDecorator = (
  value: Function,
  context: {
    kind: "method";
    name: string | symbol;
    access: { get(): unknown };
    static: boolean;
    private: boolean;
    addInitializer(initializer: () => void): void;
  }
) => Function | void;

Source

The main differences that I can see will affect us are:

  • The decorated method is now value (first argument) instead of descriptor.value (3rd argument, which we use now)
  • Number of arguments goes from 3 to 2
  • The name of the decorated method/function is now context.name and not propertyKey (which has now been removed)

The next step should be to create a small PoC to validate the findings above.

@dreamorosi
Copy link
Contributor Author

In #1667 we have revisited and simplified the tsconfig.json files in order to have a main one in the root of the project and then have each package in the workspace extend that one and apply their own specific configuration.

In order to avoid breaking changes there are two areas that we have purposefully left out:

  • importHelpers, noEmitHelpers, and downlevelIteration
  • isolatedModules

As part of this issue, which is in the v2 planning, we should also consider enabling these settings.

@dreamorosi dreamorosi moved this from Backlog to Working on it in Powertools for AWS Lambda (TypeScript) Sep 12, 2023
@dreamorosi dreamorosi linked a pull request Sep 12, 2023 that will close this issue
9 tasks
@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation and removed discussing The issue needs to be discussed, elaborated, or refined need-more-information Requires more information before making any calls labels Sep 13, 2023
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (TypeScript) Sep 13, 2023
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot removed the confirmed The scope is clear, ready for implementation label Sep 13, 2023
@github-actions github-actions bot added the pending-release This item has been merged and will be released soon label Sep 13, 2023
@github-actions
Copy link
Contributor

This is now released under v1.13.0 version!

@github-actions github-actions bot added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Sep 18, 2023
@dreamorosi dreamorosi moved this from Coming soon to Shipped in Powertools for AWS Lambda (TypeScript) Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
Development

Successfully merging a pull request may close this issue.

1 participant