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

chore: remove useless type assertion #5170

Merged
merged 3 commits into from Dec 1, 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/isPromise.ts
Expand Up @@ -4,5 +4,5 @@
* @param value the object to test
*/
export function isPromise(value: any): value is PromiseLike<any> {
return !!value && typeof (<any>value).subscribe !== 'function' && typeof (value as any).then === 'function';
return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
cartant marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 1 addition & 1 deletion src/internal/util/subscribeTo.ts
Expand Up @@ -17,7 +17,7 @@ export const subscribeTo = <T>(result: ObservableInput<T>): (subscriber: Subscri
} else if (isArrayLike(result)) {
return subscribeToArray(result);
} else if (isPromise(result)) {
return subscribeToPromise(result as Promise<any>);
return subscribeToPromise(result);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fine, though. The type assertion in the current codebase is unnecessary and can be removed.

} else if (!!result && typeof result[Symbol_iterator] === 'function') {
return subscribeToIterable(result as any);
} else {
Expand Down