It is not possible to directly obtain a list of typeof
results within native JavaScript.
If such information is available, it would typically be accessed through a library or as part of the API provided by a specific environment.
In TypeScript, you can create a type that encompasses all potential primitive types, demonstrated in this particular answer:
const uselessVariable = typeof (1 as any);
// type Test = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
type Test = typeof uselessVariable;
Link to Playground
In TypeScript, the typeof
operator in JavaScript is associated with a return type that is limited to the possible outcomes for it.