Skip to content
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

TS conversion starting point #783

Merged
merged 12 commits into from
Aug 2, 2023
Merged

TS conversion starting point #783

merged 12 commits into from
Aug 2, 2023

Conversation

eritbh
Copy link
Member

@eritbh eritbh commented Jul 13, 2023

Converts the first set of stuff to Typescript for #761. Everything still builds, yay!

  • Note the compilerOptions.outDir hack in tsconfig.json - @rollup/plugin-typescript ignores all output options and does its own thing to pull the build output into the rollup bundle, and it will also just let you pass the tsconfig structure directly to the plugin instead of reading from a file, so it's not strictly necessary to have a tsconfig.json in the first place. However a lot of tooling relies on having a tsconfig.json to know what's going on, so I decided to just point outDir to a throwaway directory in build.

    • This directory will only actually get used if you manually tsc the project, which you should never need to do since rollup will choke on TS errors thanks to noEmitOnError. Might be useful at some point in the future for debugging more arcane errors or emergent issues in rollup/its TS plugin though.
  • There is no linting for TS files because I don't feel like duplicating our entire linter config into typescript-eslint rules at the moment - this should get done before this PR gets merged though this will be handled in a separate issue Rework project formatting #784 because the ecosystem has changed significantly

    • it would probably make sense for us to break this out into its own shareable config module on npm at some point, so we can share the config easily between this and toolbox-devvit
  • JS and TS files have different conventions for how file extensions on imports work:

    • In a Javascript file, importing anything requires the source file's extension
    • In a Typescript file, importing another Typescript file requires that the file extension not be present
    • In a Typescript file, importing a Javascript file works whether or not the extension is present

    I've opted to change as little as possible to get the build to work; eventually everything will be Typescript files importing other Typescript files anyway, at which point every import will be extensionless.

@eritbh eritbh marked this pull request as draft July 13, 2023 13:42
@eritbh eritbh mentioned this pull request Jul 13, 2023
@eritbh eritbh marked this pull request as ready for review July 13, 2023 15:49
tsconfig.json Outdated Show resolved Hide resolved
@eritbh eritbh added this to the v6.2.0 milestone Aug 2, 2023
@eritbh
Copy link
Member Author

eritbh commented Aug 2, 2023

this is where the fun begins

@eritbh eritbh merged commit 6fe4593 into master Aug 2, 2023
@eritbh eritbh deleted the chore/ts branch August 2, 2023 21:03
eritbh added a commit that referenced this pull request Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants