File tree Expand file tree Collapse file tree 5 files changed +24
-1
lines changed Expand file tree Collapse file tree 5 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1+ declare function isBooleanObject ( value : unknown ) : value is boolean | Boolean ;
2+
3+ export = isBooleanObject ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ var callBound = require('call-bind/callBound');
44var $boolToStr = callBound ( 'Boolean.prototype.toString' ) ;
55var $toString = callBound ( 'Object.prototype.toString' ) ;
66
7+ /** @type {import('.') } */
78var tryBooleanObject = function booleanBrandCheck ( value ) {
89try {
910$boolToStr ( value ) ;
@@ -15,6 +16,7 @@ var tryBooleanObject = function booleanBrandCheck(value) {
1516var boolClass = '[object Boolean]' ;
1617var hasToStringTag = require ( 'has-tostringtag/shams' ) ( ) ;
1718
19+ /** @type {import('.') } */
1820module . exports = function isBoolean ( value ) {
1921if ( typeof value === 'boolean' ) {
2022return true ;
Original file line number Diff line number Diff line change 2020"posttest" : " npx npm@'>=10.2' audit --production" ,
2121"prelint" : " eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\ .git')" ,
2222"lint" : " eslint --ext=js,mjs ." ,
23+ "postlint" : " tsc -p . && attw -P" ,
2324"version" : " auto-changelog && git add CHANGELOG.md" ,
2425"postversion" : " auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \" v$(node -e \" console.log(require('./package.json').version)\" )\" "
2526},
4243"has-tostringtag" : " ^1.0.2"
4344},
4445"devDependencies" : {
46+ "@arethetypeswrong/cli" : " ^0.17.0" ,
4547"@ljharb/eslint-config" : " ^21.1.1" ,
48+ "@ljharb/tsconfig" : " ^0.2.0" ,
49+ "@types/call-bind" : " ^1.0.5" ,
50+ "@types/core-js" : " ^2.5.8" ,
51+ "@types/tape" : " ^5.6.5" ,
4652"auto-changelog" : " ^2.5.0" ,
4753"core-js" : " ^3.39.0" ,
4854"eclint" : " ^2.8.1" ,
5460"npmignore" : " ^0.3.1" ,
5561"nyc" : " ^10.3.2" ,
5662"safe-publish-latest" : " ^2.0.0" ,
57- "tape" : " ^5.9.0"
63+ "tape" : " ^5.9.0" ,
64+ "typescript" : " next"
5865},
5966"testling" : {
6067"files" : " test.js" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ var hasToStringTag = require('has-tostringtag/shams')();
66
77test ( 'not Booleans' , function ( t ) {
88t . test ( 'primitives' , function ( st ) {
9+ // @ts -expect-error
910st . notOk ( isBoolean ( ) , 'undefined is not Boolean' ) ;
1011st . notOk ( isBoolean ( null ) , 'null is not Boolean' ) ;
1112st . notOk ( isBoolean ( 0 ) , '0 is not Boolean' ) ;
@@ -30,6 +31,7 @@ test('not Booleans', function (t) {
3031} ) ;
3132
3233test ( '@@toStringTag' , { skip : ! hasToStringTag } , function ( t ) {
34+ /** @type {{ toString(): unknown; valueOf(): unknown; [Symbol.toStringTag]?: string; } } */
3335var fakeBoolean = {
3436toString : function ( ) { return 'true' ; } ,
3537valueOf : function ( ) { return true ; }
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " @ljharb/tsconfig" ,
3+ "compilerOptions" : {
4+ "target" : " ES2021" ,
5+ },
6+ "exclude" : [
7+ " coverage"
8+ ]
9+ }
You can’t perform that action at this time.
0 commit comments