mobxjs / mobx-state-tree

Full-featured reactive state management without the boilerplate
https://mobx-state-tree.js.org/
MIT License
6.9k stars 639 forks source link

feat: add t export, update documentation #2117

Closed coolsoftwaretyler closed 8 months ago

coolsoftwaretyler commented 8 months ago

What does this PR do and why?

This PR adds a new exported namespace from mobx-state-tree, called t. The intention is to disambiguate the idea of "types" from "the thing MST exports that people use to create models and stuff".

It's very common for users and maintainers alike to be discussing both TypeScript and MobX-State-Tree in the same context, and overloading the word "types" can be a bit of a pain.

This change gives us the option to write import { t } from "mobx-state-tree", and discuss that namespace as t, which should improve communication in both code and person-to-person communication. Jamon and I have been kicking this idea around for a while and I wanted to get it out there since it's a quick win, IMO.

Steps to validate locally

This change adds some notes through the docs making note of it. I also ran yarn build-docs, which created a bigger diff than this really is.

To check my work, the relevant files are:

Any other changes are auto-generated.

I added a test that checks for that export. It will fail if you remove the change in src/index.ts. This has no impact on the existing types namespace.

coolsoftwaretyler commented 8 months ago

Thanks Jamon! I agree. Gonna merge this in.