Skip to content

Commit

Permalink
Add bigint to the primitive type (#87)
Browse files Browse the repository at this point in the history
* Add 'bigint' to Primitive type

* Update readme to include bigint, reword the description, included link to mdn 'typeof'

* Change syntax of npm scripts so they run correctly on my machine (win10, using tooling from this package)

* Fix documentation

* TS-Doc change: Make example for 'Primitive' usage transport its message more clearly
  • Loading branch information
9SMTM6 authored and piotrwitek committed Jun 23, 2019
1 parent b221ec3 commit 6d1af24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ Issues can be funded by anyone and the money will be transparently distributed t

### `Primitive`

Type representing primitive types in TypeScript: `number | boolean | string | symbol`
Type representing primitive types in JavaScript, and thus TypeScript: `number | bigint | boolean | string | symbol`

You can test for singular of these types with [`typeof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)

[⇧ back to top](#table-of-contents)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"ci-check": "npm run prettier && npm run lint && npm run tsc && npm run test",
"reinstall": "rm -rf node_modules/ dist/ && npm install",
"prettier": "prettier --list-different 'src/**/*.ts' || (echo '\nPlease fix code formatting by running:\nnpm run prettier:fix\n'; exit 1)",
"prettier:fix": "prettier --write 'src/**/*.ts'",
"lint": "tslint --project './tsconfig.json'",
"prettier:fix": "prettier --write src/**/*.ts",
"lint": "tslint --project ./tsconfig.json",
"tsc": "tsc -p . --noEmit",
"tsc:watch": "tsc -p . --noEmit -w",
"test": "jest --config jest.config.json",
"test:watch": "jest --config jest.config.json --watch",
"test:update": "jest --config jest.config.json --no-cache -u && dts-jest-remap ./src/*.spec.ts --rename '{{basename}}.snap.{{extname}}'",
"test:update": "jest --config jest.config.json --no-cache -u && dts-jest-remap ./src/*.spec.ts --rename {{basename}}.snap.{{extname}}",
"prebuild": "rm -rf dist/",
"build": "tsc -p ./tsconfig.build.json --outDir dist/",
"prepublishOnly": "npm run reinstall && npm run ci-check && npm run build"
Expand Down
8 changes: 4 additions & 4 deletions src/mapped-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

/**
* Primitive
* @desc Type representing primitive types in TypeScript: `number | boolean | string | symbol`
* @desc Type representing primitive types in TypeScript: `number | bigint | boolean | string | symbol`
* @example
* type Various = number | boolean | string | symbol | object;
* type Various = number | string | object;
*
* // Expect: object
* Exclude<Various, Primitive>
* type Cleaned = Exclude<Various, Primitive>
*/
export type Primitive = number | boolean | string | symbol;
export type Primitive = number | bigint | boolean | string | symbol;

/**
* Falsey
Expand Down

0 comments on commit 6d1af24

Please sign in to comment.