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
This was originally added in #17082. We could revisit this decision, but case-insensitive primitives and Object as any are good decisions in my opinion.
ExE Boss (@ExE-Boss) you can use the type NonPrimitive = object in one of your own d.ts files. Unfortunately, lots of existing JS code uses object to mean any or unknown, even projects like webpack that compile regularly with typescript.
Activity
sandersn commentedon Jul 16, 2018
I think this is a result of Object/object being treated as any. For example,
/** @typedef {{}} T */produces an error.sandersn commentedon Jul 16, 2018
In
getTypeFromTypeNode, we have:This was originally added in #17082. We could revisit this decision, but case-insensitive primitives and Object as any are good decisions in my opinion.
[-]@typedef with no properties treated as 'any'[/-][+]In JS, `object` is treated as 'any'[/+]18 remaining items
thorn0 commentedon Feb 21, 2020
can be closed as fixed by #35661 ?
sandersn commentedon Feb 21, 2020
Maybe. #35661 only applies when
noImplicitAny: truethough.ExE-Boss commentedon Feb 21, 2020
I’d like if there was a way to use the
objecttype in JSDoc without needing to enablenoImplicitAny.sandersn commentedon Feb 21, 2020
ExE Boss (@ExE-Boss) you can use the
type NonPrimitive = objectin one of your own d.ts files. Unfortunately, lots of existing JS code usesobjectto meananyorunknown, even projects like webpack that compile regularly with typescript.ExE-Boss commentedon Feb 16, 2021
Nathan Shively-Sanders (@sandersn) I’ve personally been using:
Which is the inlined form of:
/** @typedef {NonNullable<Parameters<typeof Object.create>[0]>} obj */DanielRosenwasser commentedon May 5, 2026
Keywords: object non-primitive non primitve nonprimitive jsdoc
DanielRosenwasser commentedon May 5, 2026
Looks like TypeScript 7 might end up actually doing this.