Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: deprecate error ctors (#6277)
* chore: add deprecations to error ctors * test: add test for error ctor deprecations * chore: remove old dtslint comment - TS 2.8 lol
- Loading branch information
Showing
10 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { AjaxError, AjaxTimeoutError } from 'rxjs/ajax'; | ||
import { | ||
ArgumentOutOfRangeError, | ||
EmptyError, | ||
NotFoundError, | ||
ObjectUnsubscribedError, | ||
SequenceError, | ||
TimeoutError, | ||
UnsubscriptionError | ||
} from 'rxjs'; | ||
|
||
it('should deprecate error construction', () => { | ||
let error: Error; | ||
error = new AjaxError('message', null!, null!); // $ExpectDeprecation | ||
error = new ArgumentOutOfRangeError(); // $ExpectDeprecation | ||
error = new EmptyError(); // $ExpectDeprecation | ||
error = new NotFoundError('message'); // $ExpectDeprecation | ||
error = new ObjectUnsubscribedError(); // $ExpectDeprecation | ||
error = new SequenceError('message'); // $ExpectDeprecation | ||
error = new TimeoutError(); // $ExpectDeprecation | ||
error = new UnsubscriptionError([]); // $ExpectDeprecation | ||
}); | ||
|
||
it('should not deprecate instanceof use', () => { | ||
const error = new Error('message'); | ||
let b: boolean; | ||
b = error instanceof AjaxError; // $ExpectNoDeprecation | ||
b = error instanceof ArgumentOutOfRangeError; // $ExpectNoDeprecation | ||
b = error instanceof EmptyError; // $ExpectNoDeprecation | ||
b = error instanceof NotFoundError; // $ExpectNoDeprecation | ||
b = error instanceof ObjectUnsubscribedError; // $ExpectNoDeprecation | ||
b = error instanceof SequenceError; // $ExpectNoDeprecation | ||
b = error instanceof TimeoutError; // $ExpectNoDeprecation | ||
b = error instanceof UnsubscriptionError; // $ExpectNoDeprecation | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
// TypeScript Version: 2.8 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters