Skip to content

chore: local support for node --strip-types #158

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuperchupuDev
Copy link
Contributor

@SuperchupuDev SuperchupuDev commented Jul 7, 2025

Note

This PR doesn't affect the published dist code nor any file that's published to npm whatsoever. Its only purpose is to improve the experience of working with fdir's typescript source code, for people who clone the repo to contribute to it.

Currently, whenever you want to locally do a small test on fdir (to see if the code is working etc), you have to rebuild each time you change the source code, unless you use something like ts-node. This works, but it's far from ideal.

Now that important PRs are merged, I'm proposing a small change that would greatly improve DX for anyone contributing to this project. Months ago, node released support for natively running typescript code, but it requires the code to specify type imports, do not make use of any non-erasable syntax (such as enums) and specify the .ts extension when importing typescript files.

This PR makes the necessary changes to the source code to allow you to allow you to import fdir's typescript files directly in node:

// a.ts
import { fdir } from "./src/index.ts";
const api = new fdir()
  .withFullPaths()
  .crawl('.');

const result = await api.withPromise();
console.log(result.length);
$ node a.ts
7100

This PR doesn't remove support for anything, all tools still work fine, like ts-node or vitest

It also prevents tsc from emitting any code, since we're supposed to build with tsdown now, removes the forceConsistentCasingInFileNames config option (since it's on by default) and adds a typecheck workflow (the test workflow never did any typechecking) with dependency caching to significantly reduce CI times.

I haven't removed ts-node from the dev dependencies since you still might want to use it when benchmarking on node versions that don't have --strip-types.

This PR affects many files and I'd completely understand if it doesn't get accepted. It would just really improve the experience of contributing to fdir.

@SuperchupuDev SuperchupuDev force-pushed the chore/strip-types-support branch from f550359 to edd8347 Compare July 7, 2025 15:06
@SuperchupuDev SuperchupuDev force-pushed the chore/strip-types-support branch from edd8347 to b8dca90 Compare July 7, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant