-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
make type definitons "module": "nodenext"
compatible
#184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure which TypeScript update make it not work.
But it will break more people than it should.
So, I think this PR should not be merged.
Can you give more context on "breaking"? It passes the test suite, so everything should be fine |
also
|
The problem actually comes from |
it seems to be expected behaviour from TS side, it is CJS module so it should use CJS export |
@climba03003 pushed changes to fix default export function type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a unit test? we use tsd to test our types
Idk what can also be tested, current test suite looks completed to me |
…to nodenext-export
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will not block this PR to be merged and I would like to see the namespace written in PascalCase
.
@fastify/typescript just ping more people in to decide what's the next steps.
PascalCase sounds good to me, will add corresponding changes |
Ah well actually @climba03003 PascalCase is no go here. fastifyCookie namespace is merged with fastifyCookie function, and PascalCase for function name doesn't sound great |
Sad for this info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you include a test for ESM? Reference: https://github.com/fastify/fastify/tree/main/test/esm
|
||
declare module 'fastify' { | ||
declare module "fastify" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore it? It seems unrelated to the PR goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I think it's fine to keep those, that's was formatter does for me every time I touch that file, also makes it consistent with other plugins (at least fastify-static)
I don't really see any reason to test esm since module is CJS only, these changes make typescript read module as CJS |
If the current test suite was any good, it should have detected this problem, shouldn't it? I'm just concerned about preventing a potential regression in any further PR. |
I think there is no regression as long as it passes current tsd suite, not sure what I can do to test esm in this plugin since there is no esm (.mjs) module exported |
Actually there's a regression already since 8da8fbe was added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@wight554 could you rebase? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…to nodenext-export
should be g2g |
* make type definitons `"module": "nodenext"` compatible * see microsoft/TypeScript#48845 * fix test * fix default export type * make typing extra safe and small refactoring * restore brackets * add additional properties to named export and fix test suite * remove formatting * revert formatting * reuse type
* integrate cookie signer * add algorithm as plugin-option * check for matching error message * improve tests * remove unnecessary array conversion * simplify * fix comment * restructure SignerFactory * update typings * fix exports * add benchmarks * improve perf for multi secrets * rename SignerFactory to Signer * Merge branch 'master' into integrate-cookie-signer * export signerFactory * Update signer.js * add secure: 'auto' Option (#199) * add secure: auto Option * document deviation from cookie serialize * describe better * lowercase Lax * Bumped v7.3.0 Signed-off-by: Matteo Collina <hello@matteocollina.com> * make type definitons `"module": "nodenext"` compatible (#184) * make type definitons `"module": "nodenext"` compatible * see microsoft/TypeScript#48845 * fix test * fix default export type * make typing extra safe and small refactoring * restore brackets * add additional properties to named export and fix test suite * remove formatting * revert formatting * reuse type * Bumped v7.3.1 Signed-off-by: Matteo Collina <hello@matteocollina.com> * modify types * remove dummy * fix regex bottleneck found by sonarqube Signed-off-by: Matteo Collina <hello@matteocollina.com> Co-authored-by: Matteo Collina <hello@matteocollina.com> Co-authored-by: Volodymyr Zhdanov <wight554@gmail.com>
Checklist
npm run test
andnpm run benchmark
and the Code of conduct