ci: add pull request quality gates
CI / install-and-build (pull_request) Successful in 1m29s
CI / format (pull_request) Successful in 51s
CI / typecheck-source (pull_request) Successful in 41s
CI / typecheck-tests (pull_request) Successful in 39s
CI / test (pull_request) Successful in 51s
CI / lint (pull_request) Successful in 21s
CI / install-and-build (pull_request) Successful in 1m29s
CI / format (pull_request) Successful in 51s
CI / typecheck-source (pull_request) Successful in 41s
CI / typecheck-tests (pull_request) Successful in 39s
CI / test (pull_request) Successful in 51s
CI / lint (pull_request) Successful in 21s
Co-Authored-By: gpt-5.6-terra <noreply@openai.com>
This commit was merged in pull request #12.
This commit is contained in:
+12
-14
@@ -7,11 +7,11 @@ const escapes = {
|
||||
};
|
||||
|
||||
function parseAdd<T>(
|
||||
rest: (Record<string, string> | string | ((writer: XmlWriter) => T))[]
|
||||
rest: (Record<string, string> | string | ((writer: XmlWriter) => T))[],
|
||||
): [
|
||||
props?: Record<string, string>,
|
||||
content?: string,
|
||||
children?: (writer: XmlWriter) => T
|
||||
children?: (writer: XmlWriter) => T,
|
||||
] {
|
||||
let props: Record<string, string> | undefined;
|
||||
let children: ((writer: XmlWriter) => T) | undefined;
|
||||
@@ -55,7 +55,7 @@ export class XmlWriter {
|
||||
tag: string,
|
||||
props?: Record<string, string>,
|
||||
content?: string,
|
||||
children?: NonNullable<unknown>
|
||||
children?: NonNullable<unknown>,
|
||||
) {
|
||||
const top = this.#stack.at(-1);
|
||||
if (top && !top.children) {
|
||||
@@ -104,7 +104,7 @@ export class XmlWriter {
|
||||
add(
|
||||
tag: string,
|
||||
props: Record<string, string>,
|
||||
children: (writer: XmlWriter) => void
|
||||
children: (writer: XmlWriter) => void,
|
||||
): XmlWriter;
|
||||
add(
|
||||
tag: string,
|
||||
@@ -125,23 +125,21 @@ export class XmlWriter {
|
||||
addAsync(
|
||||
tag: string,
|
||||
props: Record<string, string>,
|
||||
content: string
|
||||
content: string,
|
||||
): Promise<void>;
|
||||
addAsync(
|
||||
tag: string,
|
||||
children: (writer: XmlWriter) => Promise<void>
|
||||
children: (writer: XmlWriter) => Promise<void>,
|
||||
): Promise<void>;
|
||||
addAsync(
|
||||
tag: string,
|
||||
props: Record<string, string>,
|
||||
children: (writer: XmlWriter) => Promise<void>
|
||||
children: (writer: XmlWriter) => Promise<void>,
|
||||
): Promise<void>;
|
||||
async addAsync(
|
||||
tag: string,
|
||||
...rest: (
|
||||
| Record<string, string>
|
||||
| string
|
||||
| ((writer: XmlWriter) => Promise<void>)
|
||||
Record<string, string> | string | ((writer: XmlWriter) => Promise<void>)
|
||||
)[]
|
||||
): Promise<void> {
|
||||
const [props, content, children] = parseAdd(rest);
|
||||
@@ -164,7 +162,7 @@ export class XmlWriter {
|
||||
| Parameters<InstanceType<typeof XmlWriter>["add"]>
|
||||
| [
|
||||
NonNullable<ConstructorParameters<typeof XmlWriter>[0]>,
|
||||
...Parameters<InstanceType<typeof XmlWriter>["add"]>
|
||||
...Parameters<InstanceType<typeof XmlWriter>["add"]>,
|
||||
]
|
||||
): string {
|
||||
let options: ConstructorParameters<typeof XmlWriter>[0];
|
||||
@@ -172,7 +170,7 @@ export class XmlWriter {
|
||||
options = rest.shift()! as ConstructorParameters<typeof XmlWriter>[0];
|
||||
}
|
||||
return new XmlWriter(options).add(
|
||||
...(rest as Parameters<InstanceType<typeof XmlWriter>["add"]>)
|
||||
...(rest as Parameters<InstanceType<typeof XmlWriter>["add"]>),
|
||||
).content;
|
||||
}
|
||||
|
||||
@@ -188,7 +186,7 @@ export class XmlWriter {
|
||||
| Parameters<InstanceType<typeof XmlWriter>["addAsync"]>
|
||||
| [
|
||||
NonNullable<ConstructorParameters<typeof XmlWriter>[0]>,
|
||||
...Parameters<InstanceType<typeof XmlWriter>["addAsync"]>
|
||||
...Parameters<InstanceType<typeof XmlWriter>["addAsync"]>,
|
||||
]
|
||||
): Promise<string> {
|
||||
let options: ConstructorParameters<typeof XmlWriter>[0];
|
||||
@@ -197,7 +195,7 @@ export class XmlWriter {
|
||||
}
|
||||
const writer = new XmlWriter(options);
|
||||
await writer.addAsync(
|
||||
...(rest as Parameters<InstanceType<typeof XmlWriter>["addAsync"]>)
|
||||
...(rest as Parameters<InstanceType<typeof XmlWriter>["addAsync"]>),
|
||||
);
|
||||
return writer.content;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user