@@ -48,7 +48,6 @@ import {
4848} from '../saved_objects_client' ;
4949import {
5050 SavedObject ,
51- SavedObjectAttributes ,
5251 SavedObjectsBaseOptions ,
5352 SavedObjectsFindOptions ,
5453 SavedObjectsMigrationVersion ,
@@ -213,7 +212,7 @@ export class SavedObjectsRepository {
213212 * @property {array } [options.references=[]] - [{ name, type, id }]
214213 * @returns {promise } - { id, type, version, attributes }
215214 */
216- public async create < T extends SavedObjectAttributes > (
215+ public async create < T = unknown > (
217216 type : string ,
218217 attributes : T ,
219218 options : SavedObjectsCreateOptions = { }
@@ -254,7 +253,7 @@ export class SavedObjectsRepository {
254253 body : raw . _source ,
255254 } ) ;
256255
257- return this . _rawToSavedObject ( {
256+ return this . _rawToSavedObject < T > ( {
258257 ...raw ,
259258 ...response ,
260259 } ) ;
@@ -277,7 +276,7 @@ export class SavedObjectsRepository {
277276 * @property {string } [options.namespace]
278277 * @returns {promise } - {saved_objects: [[{ id, type, version, references, attributes, error: { message } }]}
279278 */
280- async bulkCreate < T extends SavedObjectAttributes = any > (
279+ async bulkCreate < T = unknown > (
281280 objects : Array < SavedObjectsBulkCreateObject < T > > ,
282281 options : SavedObjectsCreateOptions = { }
283282 ) : Promise < SavedObjectsBulkResponse < T > > {
@@ -464,7 +463,7 @@ export class SavedObjectsRepository {
464463 * @property {object } [options.hasReference] - { type, id }
465464 * @returns {promise } - { saved_objects: [{ id, type, version, attributes }], total, per_page, page }
466465 */
467- async find < T extends SavedObjectAttributes = any > ( {
466+ async find < T = unknown > ( {
468467 search,
469468 defaultSearchOperator = 'OR' ,
470469 searchFields,
@@ -577,7 +576,7 @@ export class SavedObjectsRepository {
577576 * { id: 'foo', type: 'index-pattern' }
578577 * ])
579578 */
580- async bulkGet < T extends SavedObjectAttributes = any > (
579+ async bulkGet < T = unknown > (
581580 objects : SavedObjectsBulkGetObject [ ] = [ ] ,
582581 options : SavedObjectsBaseOptions = { }
583582 ) : Promise < SavedObjectsBulkResponse < T > > {
@@ -648,7 +647,7 @@ export class SavedObjectsRepository {
648647 * @property {string } [options.namespace]
649648 * @returns {promise } - { id, type, version, attributes }
650649 */
651- async get < T extends SavedObjectAttributes = any > (
650+ async get < T = unknown > (
652651 type : string ,
653652 id : string ,
654653 options : SavedObjectsBaseOptions = { }
@@ -696,7 +695,7 @@ export class SavedObjectsRepository {
696695 * @property {array } [options.references] - [{ name, type, id }]
697696 * @returns {promise }
698697 */
699- async update < T extends SavedObjectAttributes = any > (
698+ async update < T = unknown > (
700699 type : string ,
701700 id : string ,
702701 attributes : Partial < T > ,
@@ -753,7 +752,7 @@ export class SavedObjectsRepository {
753752 * @property {string } [options.namespace]
754753 * @returns {promise } - {saved_objects: [[{ id, type, version, references, attributes, error: { message } }]}
755754 */
756- async bulkUpdate < T extends SavedObjectAttributes = any > (
755+ async bulkUpdate < T = unknown > (
757756 objects : Array < SavedObjectsBulkUpdateObject < T > > ,
758757 options : SavedObjectsBulkUpdateOptions = { }
759758 ) : Promise < SavedObjectsBulkUpdateResponse < T > > {
@@ -972,7 +971,7 @@ export class SavedObjectsRepository {
972971 // includes the namespace, and we use this for migrating documents. However, we don't
973972 // want the namespace to be returned from the repository, as the repository scopes each
974973 // method transparently to the specified namespace.
975- private _rawToSavedObject ( raw : SavedObjectsRawDoc ) : SavedObject {
974+ private _rawToSavedObject < T = unknown > ( raw : SavedObjectsRawDoc ) : SavedObject < T > {
976975 const savedObject = this . _serializer . rawToSavedObject ( raw ) ;
977976 return omit ( savedObject , 'namespace' ) ;
978977 }
0 commit comments