Skip to content

Commit

Permalink
Drop 'isPromise'
Browse files Browse the repository at this point in the history
We shouldn't do any additional validation beyound TS
  • Loading branch information
IvanGoncharov committed May 29, 2022
1 parent b773059 commit bf5171a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/components/Voyager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class Voyager extends React.Component<VoyagerProps> {

let promise = this.props.introspection(getIntrospectionQuery());

if (!isPromise(promise)) {
if (!promise instanceof Promise) {
throw new Error(
'SchemaProvider did not return a Promise for introspection.',
);
Expand Down Expand Up @@ -249,8 +249,3 @@ export default class Voyager extends React.Component<VoyagerProps> {
return props.children || null;
};
}

// Duck-type promise detection.
function isPromise(value) {
return typeof value === 'object' && typeof value.then === 'function';
}

0 comments on commit bf5171a

Please sign in to comment.