diff --git a/readme.md b/readme.md index 443d15aac..8bca8811a 100644 --- a/readme.md +++ b/readme.md @@ -151,10 +151,8 @@ Click the type names for complete docs. - [`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts) - Create a deep version of another type where all optional keys are set to also accept `undefined`. - [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep. - [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). -- [`Tagged`](source/opaque.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) if needed. -- [`UnwrapTagged`](source/opaque.d.ts) - Get the untagged portion of a tagged type created with `Tagged`. -- [`Opaque`](source/opaque.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d). This implementation only supports a single tag. -- [`UnwrapOpaque`](source/opaque.d.ts) - Get the untagged portion of a tagged type created with `Opaque` or `Tagged`. +- [`Tagged`](source/opaque.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). (This replaces the previous [`Opaque`](source/opaque.d.ts) type, which is now deprecated.) +- [`UnwrapTagged`](source/opaque.d.ts) - Get the untagged portion of a tagged type created with `Tagged`. (This replaces the previous [`UnwrapOpaque`](source/opaque.d.ts) type, which is now deprecated.) - [`InvariantOf`](source/invariant-of.d.ts) - Create an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes. - [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional. - [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly. @@ -342,7 +340,7 @@ type ShouldBeNever = IfAny<'not any', 'not never', 'never'>; - `RequireOnlyOne` - See [`RequireExactlyOne`](source/require-exactly-one.d.ts) - `AtMostOne` - See [`RequireOneOrNone`](source/require-one-or-none.d.ts) - `AllKeys` - See [`KeysOfUnion`](source/keys-of-union.d.ts) -- `Branded` - See [`Opaque`](source/opaque.d.ts) +- `Branded`, `Opaque` - See [`Tagged`](source/opaque.d.ts) ## Tips diff --git a/source/opaque.d.ts b/source/opaque.d.ts index 5b4043ca6..a517be1c1 100644 --- a/source/opaque.d.ts +++ b/source/opaque.d.ts @@ -76,6 +76,7 @@ type Person = { ``` @category Type +@deprecated Use {@link Tagged} instead */ export type Opaque = Type & TagContainer; @@ -109,6 +110,7 @@ type WillWork = UnwrapOpaque>; // number ``` @category Type +@deprecated Use {@link UnwrapTagged} instead */ export type UnwrapOpaque> = OpaqueType extends Tag