Skip to content

Commit

Permalink
Fixed a bug where 0n was not being filtered out by filter-boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Feb 20, 2023
1 parent 9236e16 commit 1f243ac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/entrypoints/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
declare namespace TSReset {
type NonFalsy<T> = T extends false | 0 | "" | null | undefined ? never : T;
type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n
? never
: T;

type WidenLiteral<T> = T extends string
? string
Expand Down
3 changes: 2 additions & 1 deletion src/tests/filter-boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down

0 comments on commit 1f243ac

Please sign in to comment.