JoshuaKGoldberg / create-typescript-app

Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. ๐Ÿ’
MIT License
1.2k stars 75 forks source link

๐Ÿš€ Feature: Are the Types Wrong workflow #1633

Closed johnnyreilly closed 1 month ago

johnnyreilly commented 3 months ago

Bug Report Checklist

Overview

You're probably familiar with @andrewbranch's https://github.com/arethetypeswrong/arethetypeswrong.github.io?tab=readme-ov-file which can be used to ensure the types are correct on a package. I've written about it here: https://johnnyreilly.com/dual-publishing-esm-cjs-modules-with-tsup-and-are-the-types-wrong#linting-your-packagejson-file-with-are-the-types-wrong

We care a lot that the package we produce has good types defined. Perhaps a useful thing would be a dedicated workflow that does something like what my blog does to validate that the types have remained correct.

What do you think?

BTW I have been contemplating writing a GitHub Action to wrap up this behaviour - I think it could be generally useful. Not a requirement though - and something we could migrate to later.

BTW @andrewbranch do you have any thoughts about a dedicated GitHub action for ATTW?

Additional Info

No response

JoshuaKGoldberg commented 3 months ago

Ha yeah this has crossed my mind. I'm a big fan of the tool of course, but I'm not convinced it's worth the extra config space + CI action usage for folks using a template like this one. If they're on the template then the types publishing should be set up well for them. Maybe it'd belong as a CI check on create-typescript-app itself, to validate that changes don't mess that up for users?

johnnyreilly commented 3 months ago

I generally don't play with my tsconfig.json / package.json on a project too often. But I do tend do that at some point. At the point I do that, I may well break the types on my package, because I'm clumsy. I'd quite like to have something to take care of making sure I don't mess that up. For my money, given that the project is "create-typescript-app" (i.e. it cares about types) having something like this built in feels like a logical fit. You're right, you'd expect this to fail pretty rarely, and others maybe don't update their tsconfig.json / package.json as I do, so it's probably lower in the risk stakes compared to other checks.

I suspect there's an aspect of preference here; for instance I never use knip etc, which other folk would be very important to some people. Whilst I have great anxiety about my types being out of whack! I quite like the idea of a CI check that protects me from myself.

But yeah, I think I personally would like this check to exist, whether it needs to be in CTA is another thing.

andrewbranch commented 3 months ago

do you have any thoughts about a dedicated GitHub action for ATTW?

Iโ€™m pretty sure I saw that someone made one already ๐Ÿค” Iโ€™m not against it, but I feel like it doesnโ€™t get any easier than run: npx @arethetypeswrong/cli. What are the benefits of wrapping it in an Action?

johnnyreilly commented 3 months ago

You make a good point - there's not really any particular benefits of wrapping in an action. Maybe just as good to put something in the README to that effect? "If you want to run this in a pipeline all you need is npx @arethetypeswrong/cli"

github-actions[bot] commented 1 month ago

:tada: This is included in version v1.73.0 :tada:

The release is available on:

Cheers! ๐Ÿ“ฆ๐Ÿš€

JoshuaKGoldberg commented 1 month ago

Oh, this was really more of a chore:... ah well.