Besides the common utility types that have their own pages, TypeScript ships several more. All of them work inside JSDoc braces unchanged; this page covers the rest, with what each is for.
Record<K, V> has its own page under Collections.
At a glance
| Use | JSDoc in a .js file | TypeScript in a .ts file |
|---|---|---|
| The instance of a class | {InstanceType<typeof Cart>} | InstanceType<typeof Cart> |
| A constructor's parameters | {ConstructorParameters<typeof Cart>} | ConstructorParameters<typeof Cart> |
| Infer from one argument only | /** @param {NoInfer<T>} fallback */ | (fallback: NoInfer<T>) |
| Change a string's case | {Uppercase<Kind>} | Uppercase<Kind> |
| A function's this type | {ThisParameterType<typeof fn>} | ThisParameterType<typeof fn> |
Examples
export class Cart {
/**
* @param {string} owner
* @param {string} [currency]
*/
constructor(owner, currency = "USD") {
this.owner = owner;
this.currency = currency;
}
}
/** @typedef {InstanceType<typeof Cart>} CartInstance */
/** @typedef {ConstructorParameters<typeof Cart>} CartArgs */
/** @type {CartArgs} */
const args = ["Jane", "EUR"];
/** @type {CartInstance} */
const cart = new Cart(...args);
cart.currency.toLowerCase();
export { cart };jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} /** @typedef {"tee" | "mug"} Kind */
/** @typedef {Uppercase<Kind>} KindCode */
/** @type {KindCode} */
const ok = "TEE";
/** @type {KindCode} */
const wrong = "Tee";error TS2820: Type '"Tee"' is not assignable to type '"TEE" | "MUG"'. Did you mean '"TEE"'?
/** @type {Capitalize<Kind>} */
const label = "Mug";
export { ok, wrong, label };jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} /**
* @template {string} T
* @param {T[]} sizes
* @param {NoInfer<T>} fallback
*/
export function pickSize(sizes, fallback) {
return sizes[0] ?? fallback;
}
pickSize(["S", "M", "L"], "M");
pickSize(["S", "M", "L"], "XL");error TS2345: Argument of type '"XL"' is not assignable to parameter of type '"S" | "M" | "L"'.jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} InstanceType and ConstructorParameters
InstanceType<typeof Cart> is the type of new Cart(…), and ConstructorParameters<typeof Cart> is the tuple of the constructor's parameter types. They matter when a class arrives as a value, for example in a factory typed with a generic constructor type; for a class you can name, {Cart} is already the instance type. The handbook lists InstanceType from TypeScript 2.8 and ConstructorParameters from 3.1.
NoInfer
NoInfer<T> stops TypeScript from using an argument to infer T. In the third example, T is inferred from sizes alone, so the fallback must be one of those sizes and "XL" is TS2345. Without NoInfer, the fallback would widen T to include "XL". The handbook lists it from TypeScript 5.4.
Uppercase, Lowercase, Capitalize, Uncapitalize
These change the case of string literal types: Uppercase<"tee" | "mug"> is "TEE" | "MUG", so "Tee" is rejected (TS2820, with a suggestion), as the second example shows. They are mostly used inside template literal types.
ThisParameterType and OmitThisParameter
ThisParameterType<F> is the declared this type of a function type, and OmitThisParameter<F> is the same function type without it, which is what fn.bind(obj) returns. The handbook lists both from TypeScript 3.3.
Gotchas
ThisType<T>is a marker for object literals that sets the type ofthisinside their methods; it does nothing on its own and needsnoImplicitThis.- Utility types are ordinary type declarations in TypeScript's standard library, so they need no import and work in every JSDoc tag that takes a type.
Questions
Can I use every TypeScript utility type in JSDoc?
Yes. They are part of TypeScript's built-in library, and a JSDoc type is TypeScript type syntax, so Partial, Pick, NoInfer and the rest all work inside the braces.
Sources
- Utility Types · TypeScript handbook
- Template Literal Types: intrinsic string manipulation types · TypeScript handbook
Last reviewed 20 October 2026.