kungfooman / RuntimeTypeInspector.js

Checking JSDoc types at runtime for high-quality types - Trust is good, control is better.
MIT License
8 stars 0 forks source link

Validate mapped types #117

Closed kungfooman closed 6 months ago

kungfooman commented 6 months ago

Example:

/**
 * @typedef {{[K in 1|2|3]: {testkey: K}}} Test
 */
/**
 * @param {Test} x - First argument.
 * @returns {Test} - Return value.
 */
function identity(x) {
  return x;
}
identity(123);

REPL