Search Terms
Suggestion
There should be a compiler option like strictJSDocTypes or something to disable the object to any conversion present in TypeScript’s JSDoc parser.
Use Cases
I’m currently forced to use:
/** @typedef {NonNullable<Parameters<typeof Object.create>[0]>} obj */
to get a reference to TypeScript’s object type.
Examples
Any code where I use the above.
The following code creates an object with writable, configurable and non‑enumerable properties:
var ES = require("es-abstract");
var define = require("define-properties");
var $ObjectCreate = GetIntrinsic("%Object.create%", true);
/**
* @template {object} M
* @param {object | null} proto
* @param {M & ThisType<any>} [props]
* @return {object}
*/
function createObj(proto, props) {
var result = ES.ObjectCreate(proto);
if (arguments.length > 1) {
define(result, props);
}
return result;
}
All instances of object in the above code currently have to be replaced with the obj type alias.
Checklist
My suggestion meets these guidelines:
Search Terms
Suggestion
There should be a compiler option like
strictJSDocTypesor something to disable theobjecttoanyconversion present in TypeScript’s JSDoc parser.Use Cases
I’m currently forced to use:
/** @typedef {NonNullable<Parameters<typeof Object.create>[0]>} obj */to get a reference to TypeScript’s
objecttype.Examples
Any code where I use the above.
The following code creates an object with writable, configurable and non‑enumerable properties:
All instances of
objectin the above code currently have to be replaced with theobjtype alias.Checklist
My suggestion meets these guidelines: