Skip to content

Commit

Permalink
fix: comment out test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
braebo committed May 20, 2024
1 parent f796fa9 commit 1960721
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions src/lib/utils/isType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,79 +16,79 @@ export function isType<const _T extends any, const U extends string>(
return '__type' in value && (value as any)['__type'] === type
}

interface A {
__type?: 'a'
bar: 'baz'
}
// interface A {
// __type?: 'a'
// bar: 'baz'
// }

const a: A = {
__type: 'a',
bar: 'baz',
}
// const a: A = {
// __type: 'a',
// bar: 'baz',
// }

const isA = isType(a, 'a')
if (isA) {
a //=>
} else {
a //=>
}
// console.log(`a is ${isA ? 'A' : 'not A'}`)
// const isA = isType(a, 'a')
// if (isA) {
// a //=>
// } else {
// a //=>
// }
// // console.log(`a is ${isA ? 'A' : 'not A'}`)

const b = {
__type: 'b',
bar: 'baz',
}
// const b = {
// __type: 'b',
// bar: 'baz',
// }

const isB = isType(b, 'a')
if (isB) {
b //=>
} else {
b //=>
}
// console.log(`b is ${isB ? 'A' : 'not A'}`)
// const isB = isType(b, 'a')
// if (isB) {
// b //=>
// } else {
// b //=>
// }
// // console.log(`b is ${isB ? 'A' : 'not A'}`)

const number = 1 as any
const isNumber = isType(number, 'number')
// const number = 1 as any
// const isNumber = isType(number, 'number')

if (isNumber) {
number //=>
} else {
number //=>
}
// console.log(`number is ${isNumber ? 'number' : 'not number'}`)
// if (isNumber) {
// number //=>
// } else {
// number //=>
// }
// // console.log(`number is ${isNumber ? 'number' : 'not number'}`)

const string = 'string' as any
const isString = isType(string, 'string')
if (isString) {
string //=>
} else {
string //=>
}
// console.log(`string is ${isString ? 'string' : 'not string'}`)
// const string = 'string' as any
// const isString = isType(string, 'string')
// if (isString) {
// string //=>
// } else {
// string //=>
// }
// // console.log(`string is ${isString ? 'string' : 'not string'}`)

const boolean = true as any
const isBoolean = isType(boolean, 'boolean')
if (isBoolean) {
boolean //=>
} else {
boolean //=>
}
// console.log(`boolean is ${isBoolean ? 'boolean' : 'not boolean'}`)
// const boolean = true as any
// const isBoolean = isType(boolean, 'boolean')
// if (isBoolean) {
// boolean //=>
// } else {
// boolean //=>
// }
// // console.log(`boolean is ${isBoolean ? 'boolean' : 'not boolean'}`)

const func = (() => {}) as any
const isFunction = isType(func, 'function')
if (isFunction) {
func //=>
} else {
func //=>
}
// console.log(`func is ${isFunction ? 'function' : 'not function'}`)
// const func = (() => {}) as any
// const isFunction = isType(func, 'function')
// if (isFunction) {
// func //=>
// } else {
// func //=>
// }
// // console.log(`func is ${isFunction ? 'function' : 'not function'}`)

const obj = {} as any
const isObject = isType(obj, 'object')
if (isObject) {
obj //=>
} else {
obj //=>
}
// console.log(`object is ${isObject ? 'object' : 'not object'}`)
// const obj = {} as any
// const isObject = isType(obj, 'object')
// if (isObject) {
// obj //=>
// } else {
// obj //=>
// }
// // console.log(`object is ${isObject ? 'object' : 'not object'}`)

0 comments on commit 1960721

Please sign in to comment.