Skip to content

Commit 9ccf255

Browse files
committed
fix(types): use new utility types
1 parent ec637d8 commit 9ccf255

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

src/dependencies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function sortByKey(deps: Record<string, string>) {
99

1010
export function dependencies({ features }: { features: string[] }) {
1111
const deps = {
12-
'@openapi-typescript-infra/coconfig': '^4.1.0',
13-
'@openapi-typescript-infra/service': '^2.7.1',
12+
'@openapi-typescript-infra/coconfig': '^4.2.0',
13+
'@openapi-typescript-infra/service': '^2.7.3',
1414
} as Record<string, string>;
1515
if (features.includes('db')) {
1616
Object.assign(deps, {

templates/all/src/index.ts.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { Kysely, PostgresDialect } from 'kysely';
77
import type { DB } from './generated/database';
88
{{else}}
99
{{/inArray}}
10-
import type { {{properCase name}}Locals, {{properCase name}}Service, {{properCase name}}ConfigSchema } from './types';
10+
import type { {{properCase name}}, {{properCase name}}ConfigSchema } from './types';
1111

1212
type Config = {{properCase name}}ConfigSchema;
1313

14-
export function service(): {{properCase name}}Service {
15-
const base = useService<{{properCase name}}Locals>();
14+
export function service(): {{properCase name}}['Service'] {
15+
const base = useService<{{properCase name}}['ServiceLocals']>();
1616
return {
1717
...base,
1818
async start(app) {

templates/all/src/types/service.ts.hbs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
Service,
77
ServiceExpress,
88
ServiceLocals,
9+
ServiceTypes,
910
} from '@openapi-typescript-infra/service';
1011

1112
{{#inArray features 'db'}}
@@ -19,16 +20,9 @@ export interface {{properCase name}}Locals extends ServiceLocals {
1920
{{/inArray}}
2021
}
2122

22-
export type {{properCase name}}RequestLocals = RequestLocals;
23+
export interface {{properCase name}}RequestLocals extends RequestLocals {}
2324

24-
export type {{properCase name}}Request = RequestWithApp<{{properCase name}}Locals>;
25-
26-
export type {{properCase name}}Service = Service<
27-
{{properCase name}}Locals,
28-
{{properCase name}}RequestLocals
29-
>;
30-
31-
export type {{properCase name}}App = ServiceExpress<{{properCase name}}Locals>;
25+
export interface {{properCase name}} extends ServiceTypes<{{properCase name}}Locals, {{properCase name}}RequestLocals> {}
3226

3327
export type {{properCase name}}Api = operationHandlers<
3428
{{properCase name}}Locals,

0 commit comments

Comments
 (0)