-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: support native type stripping for Node >= v23 #442
feat: support native type stripping for Node >= v23 #442
Conversation
|
||
t.test('independent of module support', function (t) { | ||
t.plan(8) | ||
t.plan(typeStrippingEnabled ? 7 : 8) |
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 be removed when #440 is merged.
Can you add something in the README? |
If you run |
Not the indentation, but remove semi-colons, use single-quotes etc. |
mmm so how does |
Probably because it doesn't enforce certain formatting rules, like trailing coma for example: https://github.com/fastify/fastify-autoload/pull/442/files#diff-93d89c5bddae92725a3ce7b3a38a424edb3d4f4de3b403e34af97dadee0d583eR11 |
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.
Throwing in a block until I can properly review.
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.
Too much stylistics changes.
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.
As has been said, the stylistic changes need to be reverted as it's hard to see what functionality has actually changed.
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.
Is it still possible to use non-native-typestripping on node 23 and newer?
If not, it needs to be ensured that you can use other typescript loaders for potentially not supported features...
@@ -1,4 +1,4 @@ | |||
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify' | |||
import type { FastifyInstance, FastifyReply, FastifyRequest } from '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.
From API docs:
Due to the nature of type stripping, the type keyword is necessary to correctly strip type imports.
const t = require('tap') | ||
const fastify = require('fastify') | ||
|
||
const basicApp = require('./basic/app.ts') |
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.
Extensions seems mandatory for ts file too.
Yes for Node 23, don't know in the future.
Edit, if you mean is it possible to use other loaders such as |
We already have tests for loaders in |
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
@jean-michelet @Eomm We deactivated trailing comma rules a while ago as there's no clear consensus on whether it should be enforced or banned (many existing code bases ban them, many new wants to enforce them) neostandard/neostandard#143 |
is it ensured, that if you use other typescript engines, that it will use them in node 23 and not just use the type stripping? So technically this should be possible in other engines |
They aren't engines but JIT-compiler TS -> JS, so Node will execute JS files when leveraged by these tools. |
Can you plz merge the PR if you're ok with changes @climba03003 @Uzlopak? |
I merge it, so the changes can be integrated in #440 |
#441
My editor has reformatted the code a bit, but eslint seems ok with some of the changes.
I think the PR is still readable and it improves readability a bit, let me know if I should revert.