Closed renovate[bot] closed 1 month ago
:tada: This PR is included in version 0.9.11-beta.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 0.9.11 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
This PR contains the following updates:
0.20.0
->1.0.0
Release Notes
mmkal/expect-type (expect-type)
### [`v1.0.0`](https://redirect.github.com/mmkal/expect-type/releases/tag/v1.0.0) [Compare Source](https://redirect.github.com/mmkal/expect-type/compare/v0.20.0...v1.0.0) ### v1! 🎉🎉🎉 After many years, expect-type is now in v1. This release does *not* add any user facing features on top of v0.20.0 or v1.0.0-rc.0. It's just "making it official". For anyone new to the project, or coming here from vitest (👋 ), the usage docs from the readme are pasted below. For anyone on an old-ish v0 version, here are links to the non-trivial changes that have gone in since v0.15.0: - [v0.20.0](https://redirect.github.com/mmkal/expect-type/releases/tag/v0.20.0): Function overloads support (proper support, beyond the default typescript functionality which eliminates all but one overloads by default) - [v0.19.0](https://redirect.github.com/mmkal/expect-type/releases/tag/0.19.0): Beefed up JSDocs thanks to [@aryaemami59](https://redirect.github.com/aryaemami59) - [v0.18.0](https://redirect.github.com/mmkal/expect-type/releases/tag/0.18.0): `.pick` and `.omit` thanks to [@aryaemami59](https://redirect.github.com/aryaemami59) - [v0.17.0](https://redirect.github.com/mmkal/expect-type/releases/tag/v0.17.0): massively improved error messages, so (in most cases) when an assertion fails you can see *what's* wrong, not just that *something* is wrong - [v0.16.0](https://redirect.github.com/mmkal/expect-type/releases/tag/v0.16.0): default to internal typescript implementation of type-identicalness. Introduce the `.branded` helper for the old behaviour. Also support function `this` parameters - thank to [@trevorade](https://redirect.github.com/trevorade) and [@papb](https://redirect.github.com/papb) Full usage docs below, for newbies (head to the [readme](https://redirect.github.com/mmkal/expect-type/blob/main/README.md) to keep up to date): *** #### Installation and usage ```cli npm install expect-type --save-dev ``` ```typescript import {expectTypeOf} from 'expect-type' ``` #### Documentation The `expectTypeOf` method takes a single argument or a generic type parameter. Neither it nor the functions chained off its return value have any meaningful runtime behaviour. The assertions you write will be *compile-time* errors if they don't hold true. ##### Features Check an object's type with `.toEqualTypeOf`: ```typescript expectTypeOf({a: 1}).toEqualTypeOf<{a: number}>() ``` `.toEqualTypeOf` can check that two concrete objects have equivalent types (note: when these assertions *fail*, the error messages can be less informative vs the generic type argument syntax above - see [error messages docs](#error-messages)): ```typescript expectTypeOf({a: 1}).toEqualTypeOf({a: 1}) ``` `.toEqualTypeOf` succeeds for objects with different values, but the same type: ```typescript expectTypeOf({a: 1}).toEqualTypeOf({a: 2}) ``` `.toEqualTypeOf` fails on excess properties: ```typescript // @ts-expect-error expectTypeOf({a: 1, b: 1}).toEqualTypeOf<{a: number}>() ``` To allow for extra properties, use `.toMatchTypeOf`. This is roughly equivalent to an `extends` constraint in a function type argument.: ```typescript expectTypeOf({a: 1, b: 1}).toMatchTypeOf<{a: number}>() ``` `.toEqualTypeOf` and `.toMatchTypeOf` both fail on missing properties: ```typescript // @ts-expect-error expectTypeOf({a: 1}).toEqualTypeOf<{a: number; b: number}>() // @ts-expect-error expectTypeOf({a: 1}).toMatchTypeOf<{a: number; b: number}>() ``` Another example of the difference between `.toMatchTypeOf` and `.toEqualTypeOf`, using generics. `.toMatchTypeOf` can be used for "is-a" relationships: ```typescript type Fruit = {type: 'Fruit'; edible: boolean} type Apple = {type: 'Fruit'; name: 'Apple'; edible: true} expectTypeOfConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - "before 4am on Monday" (UTC).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.