this function def in the example: func fetch(_ url: String) -> JSPromise { JSPromise(jsFetch(url).object!)! } should be func fetch(_ url: String) -> JSPromise<JSObject, JSError> { JSPromise(jsFetch(url).object!)! } Xcode will fix is as <Any,Any> which does not help.