total-typescript/ts-reset
### [`v0.4.2`](https://togithub.com/total-typescript/ts-reset/releases/tag/v0.4.2)
#### 0.4.2
##### Minor Changes
- [`ce9db42`](https://togithub.com/total-typescript/ts-reset/commit/ce9db42): Added support for widening in `Array.lastIndexOf`, `Array.indexOf`, `ReadonlyArray.lastIndexOf` and `ReadonlyArray.indexOf`.
- [`107dfc2`](https://togithub.com/total-typescript/ts-reset/commit/107dfc2): Changed the array.includes on readonly arrays to NOT be a type predicate. Before this change, this perfectly valid code would not behave correctly.
```ts
type Code = 0 | 1 | 2;
type SpecificCode = 0 | 1;
const currentCode: Code = 0;
// Create an empty list of subset type
const specificCodeList: ReadonlyArray = [];
// This will be false, since 0 is not in []
if (specificCodeList.includes(currentCode)) {
currentCode; // -> SpecificCode
} else {
// This branch will be entered, and ts will think z is 2, when it is actually 0
currentCode; // -> 2
}
```
Removing the type predicate brings ts-reset closer towards correctness.
- [`4765413`](https://togithub.com/total-typescript/ts-reset/commit/4765413): author: [@mefechoel](https://togithub.com/mefechoel)
Added the `Map.has` rule.
Similar to `.includes` or `Set.has()`, `Map.has()` doesn't let you pass members that don't exist in the map's keys:
```ts
// BEFORE
const userMap = new Map([
["matt", 0],
["sofia", 1],
[2, "waqas"],
] as const);
// Argument of type '"bryan"' is not assignable to
// parameter of type '"matt" | "sofia" | "waqas"'.
userMap.has("bryan");
```
With the rule enabled, `Map` follows the same semantics as `Set`.
```ts
// AFTER
import "@total-typescript/ts-reset/map-has";
const userMap = new Map([
["matt", 0],
["sofia", 1],
[2, "waqas"],
] as const);
// .has now takes a string as the argument!
userMap.has("bryan");
```
##### Patch Changes
- [`b15aaa4`](https://togithub.com/total-typescript/ts-reset/commit/b15aaa4): Fixed an oversight with the initial `set-has` implementation by adding support to `ReadonlySet`.
### [`v0.4.1`](https://togithub.com/total-typescript/ts-reset/blob/HEAD/CHANGELOG.md#041)
##### Patch Changes
- No changes, just pushing to fix the previous slightly borked release.
### [`v0.4.0`](https://togithub.com/total-typescript/ts-reset/blob/HEAD/CHANGELOG.md#040)
##### Minor Changes
- [`ce9db42`](https://togithub.com/total-typescript/ts-reset/commit/ce9db42): Added support for widening in `Array.lastIndexOf`, `Array.indexOf`, `ReadonlyArray.lastIndexOf` and `ReadonlyArray.indexOf`.
- [`107dfc2`](https://togithub.com/total-typescript/ts-reset/commit/107dfc2): Changed the array.includes on readonly arrays to NOT be a type predicate. Before this change, this perfectly valid code would not behave correctly.
```ts
type Code = 0 | 1 | 2;
type SpecificCode = 0 | 1;
const currentCode: Code = 0;
// Create an empty list of subset type
const specificCodeList: ReadonlyArray = [];
// This will be false, since 0 is not in []
if (specificCodeList.includes(currentCode)) {
currentCode; // -> SpecificCode
} else {
// This branch will be entered, and ts will think z is 2, when it is actually 0
currentCode; // -> 2
}
```
Removing the type predicate brings ts-reset closer towards correctness.
- [`4765413`](https://togithub.com/total-typescript/ts-reset/commit/4765413): author: [@mefechoel](https://togithub.com/mefechoel)
Added the `Map.has` rule.
Similar to `.includes` or `Set.has()`, `Map.has()` doesn't let you pass members that don't exist in the map's keys:
```ts
// BEFORE
const userMap = new Map([
["matt", 0],
["sofia", 1],
[2, "waqas"],
] as const);
// Argument of type '"bryan"' is not assignable to
// parameter of type '"matt" | "sofia" | "waqas"'.
userMap.has("bryan");
```
With the rule enabled, `Map` follows the same semantics as `Set`.
```ts
// AFTER
import "@total-typescript/ts-reset/map-has";
const userMap = new Map([
["matt", 0],
["sofia", 1],
[2, "waqas"],
] as const);
// .has now takes a string as the argument!
userMap.has("bryan");
```
##### Patch Changes
- [`b15aaa4`](https://togithub.com/total-typescript/ts-reset/commit/b15aaa4): Fixed an oversight with the initial `set-has` implementation by adding support to `ReadonlySet`.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 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.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
0.3.7
->0.4.2
Release Notes
total-typescript/ts-reset
### [`v0.4.2`](https://togithub.com/total-typescript/ts-reset/releases/tag/v0.4.2) #### 0.4.2 ##### Minor Changes - [`ce9db42`](https://togithub.com/total-typescript/ts-reset/commit/ce9db42): Added support for widening in `Array.lastIndexOf`, `Array.indexOf`, `ReadonlyArray.lastIndexOf` and `ReadonlyArray.indexOf`. - [`107dfc2`](https://togithub.com/total-typescript/ts-reset/commit/107dfc2): Changed the array.includes on readonly arrays to NOT be a type predicate. Before this change, this perfectly valid code would not behave correctly. ```ts type Code = 0 | 1 | 2; type SpecificCode = 0 | 1; const currentCode: Code = 0; // Create an empty list of subset type const specificCodeList: ReadonlyArrayConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 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 has been generated by Mend Renovate. View repository job log here.