Enable exactOptionalPropertyTypes option in tsconfig (original) (raw)

What’s missing?

To enable exactOptionalPropertyTypes option in Octokit's tsconfig

Why?

Promoted by octokit/request-error.js#461, @wolfy1339 and I think it can be a good plan to enable this option.

The benefits are:

Migration plan:

Enabling this feature, considering our multirepo architecture requires a progressive migration. The 2 alternatives I come up with are:

Upgrading each package tsconfig individually and finally upgrade @octokit/tsconfig

  1. A first idea I come up with is upgrading each package's tsconfig.json individually and adding the corresponding changes to the code, if any. Even this does not imply changes in code, I assume this should be a BREAKING CHANGE because our types become more strict to our users. Is this correct?
  2. Once all the packages are upgraded, we can finally update @octokit/tsconfig by adding this new option.
  3. We wait for renovate to bump @octokit/tsconfig in all our packages.
  4. We re-visit all the packages (maybe with octoherd?) and remove the explicit rule in local's tsconfig.json

Working with beta branches

  1. We release a beta version of @octokit/tsconfig with the new property
  2. We create beta branches for each of Octokit's packages using this new version, and we apply the corresponding changes to the code if necessary.
  3. Once everything is ready, we release a new BREAKING CHANGE for all the packages.

Warning

This change implies a BREAKING CHANGE to all packages. Is this correct?

A good blog explaining its potential benefits it can be found here: https://tkdodo.eu/blog/optional-vs-undefined

  1. https://tkdodo.eu/blog/optional-vs-undefined