Ember Data Adapter: export default AdapterError (#43563)

* Ember Data Adapter: export default AdapterError

The current types use a named export

```
import { AdapterError } from '@ember-data/adapter/error';
```

compared to what is documented

```
// documented
import AdapterError from '@ember-data/adapter/error';
```

- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [x] Test the change in your own code. (Compile and run.)
- [ ] Add or edit tests to reflect the change. (Run with `npm test`.)
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).

If changing an existing definition:
- [x] Provide a URL to documentation or source code which provides context for the suggested changes: <279e55c1f6/packages/adapter/addon/error.js (L98)>

* Update error.ts
This commit is contained in:
Jonathan Haines
2020-04-04 04:19:35 +11:00
committed by GitHub
parent 8e264ca252
commit de687655a6
2 changed files with 6 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import DS from 'ember-data';
export import AdapterError = DS.AdapterError;
export default DS.AdapterError;
export import InvalidError = DS.InvalidError;
export import UnauthorizedError = DS.UnauthorizedError;
export import ForbiddenError = DS.ForbiddenError;

View File

@@ -22,5 +22,9 @@ class MyInvalid extends InvalidError {
}
}
const invalid = new MyInvalid();
const isInvalid = invalid instanceof AdapterError; // $ExpectType<boolean>
errorsHashToArray({}); // $ExpectType<any[]>
errorsArrayToHash([]); // $ExpectType<{}>