Skip to content

Revert "Re-add typed decorators (#4111)"#4129

Merged
mcollina merged 1 commit intomainfrom
revert-type-decorators
Jul 12, 2022
Merged

Revert "Re-add typed decorators (#4111)"#4129
mcollina merged 1 commit intomainfrom
revert-type-decorators

Conversation

@mcollina
Copy link
Member

This reverts commit 20263a1.

I don't think we can land this change. Moreover I don't think the change is correct.
After applying that change, I did not find a way to make https://github.com/fastify/fastify-passport/blob/4b912074ad2273172b65eb44e52201e37583226e/src/CreateInitializePlugin.ts#L9-L13 compile.

Checklist

@mcollina
Copy link
Member Author

mcollina commented Jul 11, 2022

cc @wyozi I'm happy to land the typed decorators but it should support basic usage of decorators. Something as simple as:

    fastify.decorateRequest('passport', {
      getter() {
        return passport
      },
    })

Should be supported or pass with minimal changes. As it is right now it seems it's not supported at all.

@mcollina mcollina force-pushed the revert-type-decorators branch from aba2e56 to 3d86b44 Compare July 11, 2022 13:18
@mcollina
Copy link
Member Author

@wyozi it would be great if you could make typed decorators a bit less breaking for the ecosystem.

@mcollina
Copy link
Member Author

mcollina commented Jul 12, 2022

See #4123 (comment) for a longer explanation. The typed decorators needs a bit more work and I'm going to revert them now to cut a release of Fastify.

@mcollina mcollina merged commit 07a5d9a into main Jul 12, 2022
@mcollina mcollina deleted the revert-type-decorators branch July 12, 2022 09:27
voxpelli added a commit to voxpelli/fastify that referenced this pull request Jun 26, 2023
Non-breaking backwards compatible enhancement of decorators.

Should not have the issues of fastify#4110 which was reverted in fastify#4129
voxpelli added a commit to voxpelli/fastify that referenced this pull request Jun 26, 2023
Non-breaking backwards compatible enhancement of decorators.

Should not have the issues of fastify#4110 which was reverted in fastify#4129

Signed-off-by: Pelle Wessman <pelle@kodfabrik.se>
mcollina pushed a commit that referenced this pull request Jun 30, 2023
* feat: have `decorate()` etc enforce typed values

Non-breaking backwards compatible enhancement of decorators.

Should not have the issues of #4110 which was reverted in #4129

Signed-off-by: Pelle Wessman <pelle@kodfabrik.se>

* test: test typed decoration properties

* Add support + tests for `getter`/`setter` interface

* Use the same definition for all decoration methods

---------

Signed-off-by: Pelle Wessman <pelle@kodfabrik.se>
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant