-
Notifications
You must be signed in to change notification settings - Fork 12.8k
In JS, object
is treated as 'any'
#25624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is a result of Object/object being treated as any. For example, |
In case SyntaxKind.ObjectKeyword:
return node.flags & NodeFlags.JavaScriptFile ? anyType : nonPrimitiveType 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. |
object
is treated as 'any'
Solution may be to add a new type which is definitely the same as ts's |
Maybe |
can be closed as fixed by #35661 ? |
Maybe. #35661 only applies when |
I’d like if there was a way to use the |
@ExE-Boss you can use the |
@sandersn I’ve personally been using: /** @typedef {(typeof Object.create) extends (arg0: infer T, ...args: any) => any
? (T extends null | undefined ? never : T) : never} obj */ Which is the inlined form of: /** @typedef {NonNullable<Parameters<typeof Object.create>[0]>} obj */ |
TypeScript Version: 3.0.0-dev.20180711
Code
Expected behavior:
Error at
x
:0
is not an object.Actual behavior:
No error.
The text was updated successfully, but these errors were encountered: