Open Bouke opened 6 years ago
Thanks for the report! I'll definitely look into this
@pepke41 and I have been looking into this some and plan to fix it in a coming release.
The namespace: undefined | string,
example you provided didn't work from us.
But I think we can use the unknown
type (or maybe the as
keyword?) to solve the problem instead.
This looks fixed. Isnt it?
Just ran into this issue today. I'm currently getting the same error with headers
& trustedHosts
. I'm defining them like:
@computed()
get trustedHosts() {
return [/\.somedomain/];
}
get headers() {
const headers: Headers = {
Accept: 'application/vnd.api+json',
'Content-Type': 'application/vnd.api+json',
};
// ...
return headers;
}
I've added the different return types combinations above and my own types but I still see the same error.
This has been fixed in https://github.com/ember-cli/ember-ajax/commit/2e2b0c517ea560ff92599f040b7f6d6c1f1282f9, but hasn't been released yet.
I'm experiencing this problem as well. Is it possible to publish the fix?
I'm extending the AjaxService in TypeScript like this:
Which gives the following compilation error:
In the source the value of
namespace
is defined asundefined
: https://github.com/ember-cli/ember-ajax/blob/f5d32454d519364e65ed566b50768e00a1d8d4d4/addon/mixins/ajax-request.ts#L229This means it doesn't accept a value of
string
. To allow this, the type definition needs to look like this:There's a few additional instances like this (
headers
,host
,trustedHosts
) and possibly more.