From 1f243aca672f2d3932d5c55ed56fe916f643bb77 Mon Sep 17 00:00:00 2001 From: Matt Pocock Date: Mon, 20 Feb 2023 12:06:04 +0000 Subject: [PATCH] Fixed a bug where 0n was not being filtered out by filter-boolean --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/entrypoints/utils.d.ts | 4 +++- src/tests/filter-boolean.ts | 3 ++- tsconfig.json | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 158a530..d49a9b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @total-typescript/ts-reset +## 0.3.3 + +### Patch Changes + +- Fixed a bug where 0n was not being filtered out by filter-boolean + ## 0.3.2 ### Patch Changes diff --git a/package.json b/package.json index f290872..6773348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@total-typescript/ts-reset", - "version": "0.3.2", + "version": "0.3.3", "description": "A CSS reset for TypeScript, improving types for common JavaScript API's", "private": false, "repository": "https://github.com/total-typescript/ts-reset", diff --git a/src/entrypoints/utils.d.ts b/src/entrypoints/utils.d.ts index 1f53cbf..00171cb 100644 --- a/src/entrypoints/utils.d.ts +++ b/src/entrypoints/utils.d.ts @@ -1,5 +1,7 @@ declare namespace TSReset { - type NonFalsy = T extends false | 0 | "" | null | undefined ? never : T; + type NonFalsy = T extends false | 0 | "" | null | undefined | 0n + ? never + : T; type WidenLiteral = T extends string ? string diff --git a/src/tests/filter-boolean.ts b/src/tests/filter-boolean.ts index 3584e00..4899b06 100644 --- a/src/tests/filter-boolean.ts +++ b/src/tests/filter-boolean.ts @@ -25,12 +25,13 @@ doNotExecute(() => { }); doNotExecute(() => { - const arr: (0 | null | undefined | false | "")[] = [ + const arr: (0 | null | undefined | false | "" | 0n)[] = [ 0, null, undefined, false, "", + 0n, ]; const result = arr.filter(Boolean); diff --git a/tsconfig.json b/tsconfig.json index ffe9aaa..2becd2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "module": "commonjs", /* Specify what module code is generated. */ "noEmit": true, /* Disable emitting files from a compilation. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */