File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ export function isAny(_x: unknown): _x is any {
1818 return true ;
1919}
2020
21+ /**
22+ * Always return `true` regardless of the type of `x`.
23+ */
24+ export function isUnknown ( _x : unknown ) : _x is unknown {
25+ return true ;
26+ }
27+
2128/**
2229 * Return `true` if the type of `x` is `string`.
2330 */
@@ -508,6 +515,7 @@ export function isOptionalOf<T>(
508515
509516export default {
510517 Any : isAny ,
518+ Unknown : isUnknown ,
511519 String : isString ,
512520 Number : isNumber ,
513521 BigInt : isBigInt ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import is, {
3636 isTupleOf ,
3737 isUndefined ,
3838 isUniformTupleOf ,
39+ isUnknown ,
3940 Predicate ,
4041 PredicateType ,
4142} from "./is.ts" ;
@@ -135,6 +136,26 @@ Deno.test("isAny", async (t) => {
135136 } ) ;
136137} ) ;
137138
139+ Deno . test ( "isUnknown" , async ( t ) => {
140+ await testWithExamples ( t , isUnknown , {
141+ validExamples : [
142+ "string" ,
143+ "number" ,
144+ "bigint" ,
145+ "boolean" ,
146+ "array" ,
147+ "record" ,
148+ "syncFunction" ,
149+ "asyncFunction" ,
150+ "null" ,
151+ "undefined" ,
152+ "symbol" ,
153+ "date" ,
154+ "promise" ,
155+ ] ,
156+ } ) ;
157+ } ) ;
158+
138159Deno . test ( "isString" , async ( t ) => {
139160 await testWithExamples ( t , isString , { validExamples : [ "string" ] } ) ;
140161} ) ;
You can’t perform that action at this time.
0 commit comments