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

[Draft] Semantic Versioning for TypeScript Types #3

Closed
wants to merge 2 commits into from

Conversation

chriskrycho
Copy link
Owner

@chriskrycho chriskrycho commented Mar 19, 2021

Introduce a policy for semantic versioning for TypeScript types, which accounts for both the details of TypeScript's structural type system and the need to absorb breaking changes in the TypeScript compiler. Adapted from the work done at typed-ember/ember-cli-typescript#1158 – with significant changes made to the recommendations around the supported compiler version policy (recommending two alternative approaches) and adding details around strictness.

Rendered text 📄

  • motivation
  • add discussion of strictness
  • update tsc version support policy recommendations
  • figure out the right way to frame tooling recommendations

Copy link

@dfreeman dfreeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉


For TypeScript packages be good citizens of the broader, semantically-versioned JavaScript ecosystem, package authors need a useful definition of SemVer for TypeScript’s type system.

This is somewhat more complicated than in other languages, even those other statically-typed languages with language-level SemVer guarantees (such as [Rust][rust-semver] and Elm), because TypeScript has an unusually flexible type system. In particular, its [structural type system][structural] means many more kinds of both breaking and non-breaking changes are possible than in languages with a [nominal type system][nominal]. Accordingly, this document proposes a definition of SemVer which accounts for the extra flexibility afforded by these features.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest linking to Elm's semver handling here, but it seems like the zillion blog posts extolling its virtues all link to the now-defunct elm-package repo 🙃

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually asked on the forum for that exact reasons. 🦗 🦗🦗🦗🦗

text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved

- If an interface is defined as having a property which is *not* part of the public API of the runtime object, or if an interface is defined as *missing* a a property which the public API of the runtime object does have, this is a bug.

As with runtime bugs, authors are free to fix type bugs in a patch release. As with runtime code, this may break consumers who were relying on the buggy behavior. However, as with runtime bugs, this is well-understood to be part of the sociotechnical contract of semantic versioning.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Sociotechnical Contract" would be a solid name for a prog-rock band 😄

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would 1000% listen to that band. I think I must have been reading Zeynep Tüfekçi when I wrote that.

text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
text/0000-semver-for-ts.md Outdated Show resolved Hide resolved
This RFC proposes a definition of [Semantic Versioning][semver] for
managing changes to TypeScript types, including when the TypeScript
compiler makes breaking changes in its type-checking and type emit
across a “minor”release.(Note that this RFC addresses *only* type
checking and type emit, *no t* the “transpilation”mode of the TypeScript
compiler.)

[semver]: https://semver.org

While this RFC is being authored in the context of Ember.js’ [adoption
of TypeScript as a first-cl ass supported language][RFC], its
recommendations are intentionally general, in hopes that th ese
recommendations can be widely adopted by the broader TypeScript
community.

[RFC]: emberjs#724
@chriskrycho
Copy link
Owner Author

Open as emberjs#730!

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.

2 participants