mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 12:13:52 +00:00
Merge pull request #13749 from strapi/typescript/fix/typings
[TS] Fix light typings issues
This commit is contained in:
commit
ea1ae545cc
@ -1,4 +1,5 @@
|
||||
import type Koa from 'koa';
|
||||
import { Database } from '@strapi/database';
|
||||
|
||||
import type { StringMap } from './utils';
|
||||
import type { GenericController } from '../core-api/controller'
|
||||
@ -335,6 +336,26 @@ export interface Strapi {
|
||||
* Telemetry util used to collect anonymous data on the application usage
|
||||
*/
|
||||
telemetry: any;
|
||||
|
||||
/**
|
||||
* Strapi DB layer instance
|
||||
*/
|
||||
db: Database;
|
||||
|
||||
/**
|
||||
* Core Store accessor
|
||||
*/
|
||||
store: any;
|
||||
|
||||
/**
|
||||
* Entity Validator instance
|
||||
*/
|
||||
entityValidator: any;
|
||||
|
||||
/**
|
||||
* Entity Service instance
|
||||
*/
|
||||
entityService: any;
|
||||
}
|
||||
|
||||
export interface Lifecycles {
|
||||
|
||||
22
packages/core/strapi/lib/types/factories.d.ts
vendored
22
packages/core/strapi/lib/types/factories.d.ts
vendored
@ -2,7 +2,7 @@ import { Service } from '../core-api/service';
|
||||
import { Controller, GenericController } from '../core-api/controller';
|
||||
import { Middleware } from '../middlewares';
|
||||
import { Policy } from '../core/registries/policies';
|
||||
import { Strapi } from '@strapi/strapi'
|
||||
import { Strapi } from '@strapi/strapi';
|
||||
|
||||
type ControllerConfig<T extends Controller = Controller> = T;
|
||||
|
||||
@ -10,8 +10,8 @@ type ServiceConfig = Service;
|
||||
|
||||
type HandlerConfig = {
|
||||
auth?: false | { scope: string[] };
|
||||
policies?: Array<string | Policy>;
|
||||
middlewares?: Array<string | Middleware>;
|
||||
policies?: Array<string | Policy | { name: string; config: object }>;
|
||||
middlewares?: Array<string | Middleware | { name: string; config: object }>;
|
||||
};
|
||||
|
||||
type SingleTypeRouterConfig = {
|
||||
@ -44,9 +44,17 @@ interface Router {
|
||||
routes: Route[];
|
||||
}
|
||||
|
||||
type ControllerCallback <T extends GenericController = GenericController> = (params:{strapi:Strapi}) => T;
|
||||
type ServiceCallback <T extends Service = Service> = (params:{strapi:Strapi}) => T
|
||||
type ControllerCallback<T extends GenericController = GenericController> = (params: {
|
||||
strapi: Strapi;
|
||||
}) => T;
|
||||
type ServiceCallback<T extends Service = Service> = (params: { strapi: Strapi }) => T;
|
||||
|
||||
export function createCoreRouter(uid: string, cfg?: RouterConfig = {}): () => Router;
|
||||
export function createCoreController<T extends GenericController = GenericController>(uid: string, cfg?: ControllerCallback<T> | T = {}): () => T & Controller;
|
||||
export function createCoreService<T extends Service = Service>(uid: string, cfg?: ServiceCallback<T> | T = {}): () => T ;
|
||||
export function createCoreController<T extends GenericController = GenericController>(
|
||||
uid: string,
|
||||
cfg?: ControllerCallback<T> | T = {}
|
||||
): () => T & Controller;
|
||||
export function createCoreService<T extends Service = Service>(
|
||||
uid: string,
|
||||
cfg?: ServiceCallback<T> | T = {}
|
||||
): () => T;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user