-
Notifications
You must be signed in to change notification settings - Fork 12
Typings for ember prototype extensions #8
Comments
I think we at least need the Array prototype extensions. The guides don't wrap arrays in |
My take is that we probably don't want to include typings for the As you pointed out, the array extensions seem to be the ones still widely in use. I had a branch with typings for arrays that agreed with the built-in |
I think even if they're not exported by default, we should have the prototype extensions available if someone wants to opt-in. For example you could put something like this into your declare global {
interface Function extends Ember.FunctionPrototypeExtensions {}
} Maybe it should be the same for |
Maybe we could have something like an |
Since different applications might want to opt into different combinations of prototype extensions, one thing I had been playing with locally was having "include": [
"app/**/*.ts",
"tests/**/*.ts",
"node_modules/ember-typings/types/ember/array-prototype-extensions.d.ts"
] I don't think DT is overly fond of having little extra files floating around for a single lib, though? |
If we went with #8 (comment), the ember-cli-typescript blueprint could generate some boilerplate like this // uncomment to enable prototype extensions
/*
declare global {
interface Function extends Ember.FunctionPrototypeExtensions {}
interface Array<T> extends Ember.NativeArray<T> {}
interface String extends Ember.String {}
}
*/ |
👍 Much simpler. I like that. (Sorry, I'm not sure I actually properly read #8 (comment) the first time through) |
I'm in favor of that approach as well, and in general I actually want as few things as possible ending up on DT. That's a last resort. |
Ember modifies the prototype for String, Function and Array based on
EmberENV.EXTEND_PROTOTYPES
I'd like to start a discussion about which typings we should provide for these
The text was updated successfully, but these errors were encountered: