Skip to content

Commit

Permalink
Split content into meaningful/digestible sections
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Nov 27, 2023
1 parent 7019914 commit a215d7a
Show file tree
Hide file tree
Showing 24 changed files with 1,239 additions and 1,455 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.DS_Store
public
book
1 change: 1 addition & 0 deletions .nova/Configuration.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"index.use_scm_ignored_files" : true,
"prettier.format-on-save" : "Disable",
"prettier.format-on-save.ignore-without-config" : "Global Default",
"workspace.preview_type" : "custom",
Expand Down
6 changes: 6 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Chris Krycho"]
language = "en"
multilingual = false
src = "src"
title = "Semantic Versioning for TypeScript Types"
18 changes: 15 additions & 3 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ description = "A specification for managing changes to TypeScript types, includi
compile_sass = true

# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false
build_search_index = true

# The default language; used in feeds and search index
# Note: the search index doesn't support Chinese/Japanese/Korean Languages
default_language = "en"

[search]
# Whether to include the title of the page/section in the index
include_title = true
# Whether to include the description of the page/section in the index
include_description = false
# Whether to include the rendered content of the page/section in the index
include_content = true

[markdown]
# Whether to do syntax highlighting
Expand All @@ -23,5 +35,5 @@ highlight_theme = "css"
# { theme = "charcoal", filename = "syntax-theme-dark.css" },
# ]

[extra]
# Put all your custom variables here
[link_checker]
internal_level = "warn"
1,251 changes: 0 additions & 1,251 deletions content/_index.md

This file was deleted.

163 changes: 0 additions & 163 deletions sass/style.scss

This file was deleted.

1 change: 1 addition & 0 deletions src/0-introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Introduction
27 changes: 27 additions & 0 deletions src/1-ts-and-semver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Background: TypeScript and Semantic Versioning

TypeScript ***does not*** adhere to Semantic Versioning, but since it participates in the npm ecosystem, it uses the same format for its version numbers: `<major>.<minor>.<patch>`.

In Semantic Versioning, `<major>` would be a breaking change release, `<minor>` would be a backwards-compatible feature-addition release, and `<patch>` would be a "bug fix" release.

In TypeScript, both `<major>` and `<minor>` releases *may* introduce breaking changes of the sort that Semantic Versioning reserves for the `<major>` slot in the version number. Not all `<minor>` *or* `<major>` releases *do* introduce breaking changes in the normal Semantic Versioning sense, but either *may*. Accordingly, and for simplicity, the JavaScript ecosystem should treat *all* TypeScript `<major>.<minor>` releases as a major release.

TypeScript's use of patch releases is more in line with the rest of the ecosystem's use of patch versions. The TypeScript Wiki [currently summarizes patch releases][ts-patch-releases] as follows:

> Patch releases are periodically pushed out for any of the following:
>
> - High-priority regression fixes
> - Performance regression fixes
> - Safe fixes to the language service/editing experience
>
> These fixes are typically weighed against the cost (how hard it would be for the team to retroactively apply/release a change), the risk (how much code is changed, how understandable is the fix), as well as how feasible it would be to wait for the next version.
These three categories of fixes are well within the normally-understood range of fixes that belong in a "bug fix" release in the npm ecosystem. In these cases, a user's code may stop type-checking, but *only* if they were depending on buggy behavior. This matches users' expectations around runtime code: a SemVer patch release to a package which fixes a bug may cause packages which were depending on that bug to stop working.

By example:

- `4.8.3` to `4.8.4`: always considered a bug fix
- `4.8.3` to `4.9.0`: *may or may not* introduce breaking changes; equivalent to a major in the rest of the ecosystem
- `4.9.0` to `5.0.0`: *may or may not* introduce breaking changes; equivalent to a major in the rest of the ecosystem

[ts-patch-releases]: https://github.com/microsoft/TypeScript/wiki/TypeScript's-Release-Process/e669ab1ad96edc1a7bcef5f6d9e35e24397891e5
10 changes: 10 additions & 0 deletions src/2-conformance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Conformance

To conform to this standard, a package must:

- link to the final published version of this specification
- specify the compiler support policy
- specify the currently-supported versions of TypeScript
- specify the definition of “public API” used by the library (e.g. “only documented types” vs. “all published types” etc.)
- author and publish its types with `strict: true`, `noUncheckedIndexedAccess: true`, and `exactOptionalPropertyTypes: true` in its compiler configuration
- always fully specify optional properties on objects with both `?` and `| undefined`
Loading

0 comments on commit a215d7a

Please sign in to comment.