UNPKG
flat-type-samurai
Version:
latest (0.2.0)
0.2.0
0.1.2
0.1.1
0.1.0
Advanced utility types for Typescript
flat-type-samurai
/
src
/
is-string-literal.d.ts
12 lines
(11 loc)
•
284 B
TypeScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
/** * Returns a boolean whether the passed argument is literal
string
* @example * ```ts * //
true
*
type
Case1 = IsStringLiteral<
'a'
> * //
false
*
type
Case2 = IsStringLiteral<
string
> * ``` */ export
type
IsStringLiteral<T extends
string
> =
string
extends T ?
false
:
true
;