make type definitons "module": "nodenext" compatible#184
make type definitons "module": "nodenext" compatible#184mcollina merged 11 commits intofastify:masterfrom
"module": "nodenext" compatible#184Conversation
climba03003
left a comment
There was a problem hiding this comment.
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 |
mcollina
left a comment
There was a problem hiding this comment.
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
climba03003
left a comment
There was a problem hiding this comment.
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. |
RafaelGSS
left a comment
There was a problem hiding this comment.
Could you include a test for ESM? Reference: https://github.com/fastify/fastify/tree/main/test/esm
| import { FastifyPluginCallback } from "fastify"; | ||
|
|
||
| declare module 'fastify' { | ||
| declare module "fastify" { |
There was a problem hiding this comment.
can you restore it? It seems unrelated to the PR goal.
There was a problem hiding this comment.
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 |
|
@wight554 could you rebase? |
…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 testandnpm run benchmarkand the Code of conduct