Skip to content

Commit

Permalink
Workaround type error
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed May 23, 2019
1 parent c1d3128 commit de32522
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
*/

import { Server } from 'hapi';
import { SavedObjectsClient as SavedObjectsClientClass } from '../../../../../../src/legacy/server/saved_objects';

export function getSavedObjectsClient(server: Server) {
const { SavedObjectsClient, getSavedObjectsRepository } = server.savedObjects;
const { callWithInternalUser } = server.plugins.elasticsearch.getCluster(
'admin'
);
const internalRepository = getSavedObjectsRepository(callWithInternalUser);
return new SavedObjectsClient(internalRepository);
// return new SavedObjectsClient(internalRepository);
// ^- ERROR: Cannot use 'new' with an expression whose type lacks a call or construct signature.ts(2351)
return new SavedObjectsClientClass(internalRepository); // Works!
}

0 comments on commit de32522

Please sign in to comment.