From d68328138ca0188e0dc7ddb5843aaea7256f3c44 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 30 May 2022 00:52:52 +0300 Subject: [PATCH] Drop 'isPromise' We shouldn't do any additional validation beyound TS --- src/components/Voyager.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/components/Voyager.tsx b/src/components/Voyager.tsx index 33b19c8f..3e08bd77 100644 --- a/src/components/Voyager.tsx +++ b/src/components/Voyager.tsx @@ -87,14 +87,7 @@ export default class Voyager extends React.Component { return; } - let promise = this.props.introspection(getIntrospectionQuery()); - - if (!isPromise(promise)) { - throw new Error( - 'SchemaProvider did not return a Promise for introspection.', - ); - } - + const promise = this.props.introspection(getIntrospectionQuery()); this.setState({ introspectionData: null, schema: null, @@ -249,8 +242,3 @@ export default class Voyager extends React.Component { return props.children || null; }; } - -// Duck-type promise detection. -function isPromise(value) { - return typeof value === 'object' && typeof value.then === 'function'; -}