Skip to content

Commit d683281

Browse files
committed
Drop 'isPromise'
We shouldn't do any additional validation beyound TS
1 parent b773059 commit d683281

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/components/Voyager.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,7 @@ export default class Voyager extends React.Component<VoyagerProps> {
8787
return;
8888
}
8989

90-
let promise = this.props.introspection(getIntrospectionQuery());
91-
92-
if (!isPromise(promise)) {
93-
throw new Error(
94-
'SchemaProvider did not return a Promise for introspection.',
95-
);
96-
}
97-
90+
const promise = this.props.introspection(getIntrospectionQuery());
9891
this.setState({
9992
introspectionData: null,
10093
schema: null,
@@ -249,8 +242,3 @@ export default class Voyager extends React.Component<VoyagerProps> {
249242
return props.children || null;
250243
};
251244
}
252-
253-
// Duck-type promise detection.
254-
function isPromise(value) {
255-
return typeof value === 'object' && typeof value.then === 'function';
256-
}

0 commit comments

Comments
 (0)