You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
126
-
// and since `{}` extends index signatures, the result becomes `false`.
127
-
Sextendsstring
128
-
? {}extendsRecord<S,never>
129
-
? false
130
-
: true
131
-
: false;
124
+
exporttype_IsStringLiteral<S>=(
125
+
// If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
126
+
// and since `{}` extends index signatures, the result becomes `false`.
127
+
Sextendsstring
128
+
? {}extendsRecord<S,never>
129
+
? false
130
+
: true
131
+
: false
132
+
);
132
133
133
134
/**
134
135
Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
@@ -177,11 +178,9 @@ endsWith('abc123', end);
177
178
@category Type Guard
178
179
@category Utilities
179
180
*/
180
-
exporttypeIsNumericLiteral<T>=(
181
-
TextendsNumeric
182
-
? LiteralChecks<T,Numeric>
183
-
: false
184
-
);
181
+
exporttypeIsNumericLiteral<T>=TextendsNumeric
182
+
? LiteralChecks<T,Numeric>
183
+
: false;
185
184
186
185
/**
187
186
Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
Copy file name to clipboardExpand all lines: source/is-primitive.d.ts
+3-5Lines changed: 3 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -104,11 +104,9 @@ type ex = IsNumericPrimitive<1>
104
104
@category Type Guard
105
105
@category Utilities
106
106
*/
107
-
exporttypeIsNumericPrimitive<T>=(
108
-
TextendsNumeric
109
-
? PrimitiveChecks<T,Numeric>
110
-
: false
111
-
);
107
+
exporttypeIsNumericPrimitive<T>=TextendsNumeric
108
+
? PrimitiveChecks<T,Numeric>
109
+
: false;
112
110
113
111
/**
114
112
Returns a boolean for whether the given type is strictly a `boolean` [primitive type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean).
0 commit comments