Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TS): Error impls now properly type this #4978

Merged
merged 1 commit into from Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/internal/util/ArgumentOutOfRangeError.ts
Expand Up @@ -6,7 +6,7 @@ export interface ArgumentOutOfRangeErrorCtor {
}

const ArgumentOutOfRangeErrorImpl = (() => {
function ArgumentOutOfRangeErrorImpl(this: any) {
function ArgumentOutOfRangeErrorImpl(this: Error) {
Error.call(this);
this.message = 'argument out of range';
this.name = 'ArgumentOutOfRangeError';
Expand Down
2 changes: 1 addition & 1 deletion src/internal/util/EmptyError.ts
Expand Up @@ -6,7 +6,7 @@ export interface EmptyErrorCtor {
}

const EmptyErrorImpl = (() => {
function EmptyErrorImpl(this: any) {
function EmptyErrorImpl(this: Error) {
Error.call(this);
this.message = 'no elements in sequence';
this.name = 'EmptyError';
Expand Down
2 changes: 1 addition & 1 deletion src/internal/util/ObjectUnsubscribedError.ts
Expand Up @@ -6,7 +6,7 @@ export interface ObjectUnsubscribedErrorCtor {
}

const ObjectUnsubscribedErrorImpl = (() => {
function ObjectUnsubscribedErrorImpl(this: any) {
function ObjectUnsubscribedErrorImpl(this: Error) {
Error.call(this);
this.message = 'object unsubscribed';
this.name = 'ObjectUnsubscribedError';
Expand Down
2 changes: 1 addition & 1 deletion src/internal/util/TimeoutError.ts
Expand Up @@ -6,7 +6,7 @@ export interface TimeoutErrorCtor {
}

const TimeoutErrorImpl = (() => {
function TimeoutErrorImpl(this: any) {
function TimeoutErrorImpl(this: Error) {
Error.call(this);
this.message = 'Timeout has occurred';
this.name = 'TimeoutError';
Expand Down
6 changes: 3 additions & 3 deletions src/internal/util/UnsubscriptionError.ts
Expand Up @@ -7,13 +7,13 @@ export interface UnsubscriptionErrorCtor {
}

const UnsubscriptionErrorImpl = (() => {
function UnsubscriptionErrorImpl(this: any, errors: any[]) {
function UnsubscriptionErrorImpl(this: Error, errors: (Error|string)[]) {
Error.call(this);
this.message = errors ?
`${errors.length} errors occurred during unsubscription:
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
this.name = 'UnsubscriptionError';
this.errors = errors;
(this as any).errors = errors;
return this;
}

Expand All @@ -26,4 +26,4 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
* An error thrown when one or more errors have occurred during the
* `unsubscribe` of a {@link Subscription}.
*/
export const UnsubscriptionError: UnsubscriptionErrorCtor = UnsubscriptionErrorImpl as any;
export const UnsubscriptionError: UnsubscriptionErrorCtor = UnsubscriptionErrorImpl as any;