#TypeScript: Wouldn’t it make sense to give Object.create() the return type `object` (vs. `any`)?
interface ObjectConstructor {
create(o: object | null): any;
// ···
}
-
-
True! My current working model of how TS works, is that it always considers all properties (i.e., it doesn’t distinguish own and inherited properties). The reason may well be that doing anything else would make the type system much more complex. I don’t see a simple alternative.
-
I think that's fine, I just wish it would properly type the `prototype` property of classes/functions, obj.constructor, support ES6's { __proto__: xyz }, ... These properties are special in JS and they should be special in TS too.
Kraj razgovora
Novi razgovor -
-
-
Microsoft tried to introduce vbscript as an alternate language for the web many years ago but javascript persisted. So they created typescript ...
-
Not entirely fair, I think. Especially since ES6, the TS has consistently tried to stay as close to JavaScript as possible.
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.