···11import type ts from 'typescript';
2233-import type { MaybeTsDsl, WithString } from '../base';
33+import type { MaybeTsDsl } from '../base';
44import { TsDsl } from '../base';
55import { DecoratorTsDsl } from '../decorator';
66···991010 /** Adds a decorator (e.g. `@sealed({ in: 'root' })`). */
1111 decorator(
1212- name: WithString,
1313- ...args: ReadonlyArray<MaybeTsDsl<WithString>>
1212+ name: string | ts.Expression,
1313+ ...args: ReadonlyArray<string | MaybeTsDsl<ts.Expression>>
1414 ): this {
1515 (this.decorators ??= []).push(new DecoratorTsDsl(name, ...args));
1616 return this;
+3-3
packages/openapi-ts/src/ts-dsl/mixins/do.ts
···11import type ts from 'typescript';
2233-import type { MaybeTsDsl, WithStatement } from '../base';
33+import type { MaybeTsDsl } from '../base';
44import { TsDsl } from '../base';
5566/**
77 * Adds `.do()` for appending statements or expressions to a body.
88 */
99export class DoMixin extends TsDsl {
1010- private _do?: Array<MaybeTsDsl<WithStatement>>;
1010+ private _do?: Array<MaybeTsDsl<ts.Expression | ts.Statement>>;
11111212 /** Adds one or more expressions/statements to the body. */
1313- do(...items: ReadonlyArray<MaybeTsDsl<WithStatement>>): this {
1313+ do(...items: ReadonlyArray<MaybeTsDsl<ts.Expression | ts.Statement>>): this {
1414 (this._do ??= []).push(...items);
1515 return this;
1616 }
+19-16
packages/openapi-ts/src/ts-dsl/mixins/expr.ts
···33import type { AsTsDsl } from '../as';
44import type { AttrTsDsl } from '../attr';
55import type { AwaitTsDsl } from '../await';
66-import type { MaybeTsDsl, TypeTsDsl, WithString } from '../base';
66+import type { MaybeTsDsl, TypeTsDsl } from '../base';
77import type { CallTsDsl } from '../call';
88import type { ReturnTsDsl } from '../return';
99···1515 */
16161717type AsFactory = (
1818- expr: MaybeTsDsl<WithString>,
1919- type: WithString<TypeTsDsl>,
1818+ expr: string | MaybeTsDsl<ts.Expression>,
1919+ type: string | TypeTsDsl,
2020) => AsTsDsl;
2121let asFactory: AsFactory | undefined;
2222/** Registers the Attr DSL factory after its module has finished evaluating. */
···2525}
26262727type AttrFactory = (
2828- expr: MaybeTsDsl<WithString>,
2929- name: WithString<ts.MemberName> | number,
2828+ expr: string | MaybeTsDsl<ts.Expression>,
2929+ name: string | ts.MemberName | number,
3030) => AttrTsDsl;
3131let attrFactory: AttrFactory | undefined;
3232/** Registers the Attr DSL factory after its module has finished evaluating. */
···3434 attrFactory = factory;
3535}
36363737-type AwaitFactory = (expr: MaybeTsDsl<WithString>) => AwaitTsDsl;
3737+type AwaitFactory = (expr: string | MaybeTsDsl<ts.Expression>) => AwaitTsDsl;
3838let awaitFactory: AwaitFactory | undefined;
3939/** Registers the Await DSL factory after its module has finished evaluating. */
4040export function registerLazyAccessAwaitFactory(factory: AwaitFactory): void {
···4242}
43434444type CallFactory = (
4545- expr: MaybeTsDsl<WithString>,
4646- args: ReadonlyArray<MaybeTsDsl<WithString> | undefined>,
4545+ expr: string | MaybeTsDsl<ts.Expression>,
4646+ args: ReadonlyArray<string | MaybeTsDsl<ts.Expression> | undefined>,
4747) => CallTsDsl;
4848let callFactory: CallFactory | undefined;
4949/** Registers the Call DSL factory after its module has finished evaluating. */
···5151 callFactory = factory;
5252}
53535454-type ReturnFactory = (expr: MaybeTsDsl<WithString>) => ReturnTsDsl;
5454+type ReturnFactory = (expr: string | MaybeTsDsl<ts.Expression>) => ReturnTsDsl;
5555let returnFactory: ReturnFactory | undefined;
5656/** Registers the Return DSL factory after its module has finished evaluating. */
5757export function registerLazyAccessReturnFactory(factory: ReturnFactory): void {
···60606161export class ExprMixin {
6262 /** Creates an `as` type assertion expression (e.g. `value as Type`). */
6363- as(this: MaybeTsDsl<WithString>, type: WithString<TypeTsDsl>): AsTsDsl {
6363+ as(
6464+ this: string | MaybeTsDsl<ts.Expression>,
6565+ type: string | TypeTsDsl,
6666+ ): AsTsDsl {
6467 return asFactory!(this, type);
6568 }
66696770 /** Accesses a property on the current expression (e.g. `this.foo`). */
6871 attr(
6969- this: MaybeTsDsl<WithString>,
7070- name: WithString<ts.MemberName> | number,
7272+ this: string | MaybeTsDsl<ts.Expression>,
7373+ name: string | ts.MemberName | number,
7174 ): AttrTsDsl {
7275 return attrFactory!(this, name);
7376 }
74777578 /** Awaits the current expression (e.g. `await expr`). */
7676- await(this: MaybeTsDsl<WithString>): AwaitTsDsl {
7979+ await(this: string | MaybeTsDsl<ts.Expression>): AwaitTsDsl {
7780 return awaitFactory!(this);
7881 }
79828083 /** Calls the current expression (e.g. `fn(arg1, arg2)`). */
8184 call(
8282- this: MaybeTsDsl<WithString>,
8383- ...args: ReadonlyArray<MaybeTsDsl<WithString> | undefined>
8585+ this: string | MaybeTsDsl<ts.Expression>,
8686+ ...args: ReadonlyArray<string | MaybeTsDsl<ts.Expression> | undefined>
8487 ): CallTsDsl {
8588 return callFactory!(this, args);
8689 }
87908891 /** Produces a `return` statement returning the current expression. */
8989- return(this: MaybeTsDsl<WithString>): ReturnTsDsl {
9292+ return(this: string | MaybeTsDsl<ts.Expression>): ReturnTsDsl {
9093 return returnFactory!(this);
9194 }
9295}