@total-typescript/ts-reset
Advanced tools
Comparing version 0.5.1 to 0.6.0
# @total-typescript/ts-reset | ||
## 0.6.0 | ||
### Minor Changes | ||
- 6574858: Added a rule, `/map-constructor`, to default `Map` to `Map<unknown, unknown>` when no arguments are passed to the constructor. | ||
Before, you'd get `any` for both key and value types. Now, the result of `Map.get` is `unknown` instead of `any`: | ||
```ts | ||
const userMap = new Map(); | ||
const value = userMap.get("matt"); // value: unknown | ||
``` | ||
This now is part of the recommended rules. | ||
- 5bf3a15: Added a rule, `/promise-catch`, to change the `catch` method to take `unknown` instead of `any` as an argument. | ||
```ts | ||
const promise = Promise.reject("error"); | ||
// BEFORE | ||
promise.catch((error) => { | ||
console.error(error); // error is any! | ||
}); | ||
// AFTER | ||
promise.catch((error) => { | ||
console.error(error); // error is unknown! | ||
}); | ||
``` | ||
### Patch Changes | ||
- 53cee4f: author: @none23 | ||
Fixed a bug where running .filter on a union of arrays would not work. | ||
## 0.5.1 | ||
@@ -4,0 +44,0 @@ |
/// <reference path="utils.d.ts" /> | ||
interface Array<T> { | ||
filter(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<T>[]; | ||
filter<S extends T>( | ||
predicate: BooleanConstructor, | ||
thisArg?: any, | ||
): TSReset.NonFalsy<S>[]; | ||
} | ||
interface ReadonlyArray<T> { | ||
filter(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<T>[]; | ||
filter<S extends T>( | ||
predicate: BooleanConstructor, | ||
thisArg?: any, | ||
): TSReset.NonFalsy<S>[]; | ||
} |
@@ -7,3 +7,5 @@ /// <reference path="fetch.d.ts" /> | ||
/// <reference path="set-has.d.ts" /> | ||
/// <reference path="map-constructor.d.ts" /> | ||
/// <reference path="map-has.d.ts" /> | ||
/// <reference path="array-index-of.d.ts" /> | ||
/// <reference path="promise-catch.d.ts" /> |
@@ -9,10 +9,10 @@ declare namespace TSReset { | ||
: T extends number | ||
? number | ||
: T extends boolean | ||
? boolean | ||
: T extends bigint | ||
? bigint | ||
: T extends symbol | ||
? symbol | ||
: T; | ||
? number | ||
: T extends boolean | ||
? boolean | ||
: T extends bigint | ||
? bigint | ||
: T extends symbol | ||
? symbol | ||
: T; | ||
} |
{ | ||
"name": "@total-typescript/ts-reset", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "A CSS reset for TypeScript, improving types for common JavaScript API's", | ||
@@ -53,2 +53,12 @@ "private": false, | ||
}, | ||
"./promise-catch": { | ||
"types": "./dist/promise-catch.d.ts", | ||
"import": "./dist/promise-catch.mjs", | ||
"default": "./dist/promise-catch.js" | ||
}, | ||
"./map-constructor": { | ||
"types": "./dist/map-constructor.d.ts", | ||
"import": "./dist/map-constructor.mjs", | ||
"default": "./dist/map-constructor.js" | ||
}, | ||
"./map-has": { | ||
@@ -84,8 +94,9 @@ "types": "./dist/map-has.d.ts", | ||
"devDependencies": { | ||
"@changesets/cli": "^2.26.0", | ||
"@types/node": "^18.14.0", | ||
"check-export-map": "^1.3.0", | ||
"tsx": "^3.12.3", | ||
"turbo": "^1.8.1", | ||
"typescript": "^4.9.5" | ||
"@changesets/cli": "^2.27.3", | ||
"@types/node": "^18.19.33", | ||
"check-export-map": "^1.3.1", | ||
"prettier": "^3.2.5", | ||
"tsx": "^3.14.0", | ||
"turbo": "^1.13.3", | ||
"typescript": "^5.5.4" | ||
}, | ||
@@ -102,9 +113,12 @@ "prettier": { | ||
"scripts": { | ||
"dev": "tsc --watch", | ||
"build": "tsx scripts/build.ts", | ||
"ci": "turbo build check-exports lint lint-pkg-json", | ||
"ci": "turbo build check-exports lint lint-pkg-json format:check", | ||
"check-exports": "check-export-map", | ||
"lint": "tsc", | ||
"lint-pkg-json": "tsx scripts/lint.ts", | ||
"release": "turbo run publish" | ||
"release": "turbo run publish", | ||
"format:check": "prettier \"./src/**/**.ts\" --check", | ||
"format": "prettier --write \"./src/**/**.ts\" --write" | ||
} | ||
} |
@@ -1,5 +0,3 @@ | ||
# `ts-reset` | ||
![TS Reset - Improved TypeScript's Built-in Typings](./og-image.png) | ||
TypeScript's built-in typings are not perfect. `ts-reset` makes them better. | ||
**Without `ts-reset`**: | ||
@@ -6,0 +4,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
182779
47
142
7
21