fix: resolve all TypeScript LSP errors in CLI package
1. CLI tsconfig: disable composite/declaration/declarationMap, enable noEmit — CLI runs via bun, never compiled by tsc. Eliminates all TS6059/TS6307 rootDir errors. 2. Use conditional spread to filter undefined values before passing to renderAsync/renderDirect/tag — satisfies exactOptionalPropertyTypes. 3. Fix TS2304: schemaHash not in scope in template delete catch block, use schemaInput instead. Fixes #36
This commit is contained in:
+10
-10
@@ -584,9 +584,9 @@ async function cmdRender(args: string[]): Promise<void> {
|
||||
envelope.value,
|
||||
store,
|
||||
{
|
||||
resolution,
|
||||
decay,
|
||||
epsilon,
|
||||
...(resolution !== undefined && { resolution }),
|
||||
...(decay !== undefined && { decay }),
|
||||
...(epsilon !== undefined && { epsilon }),
|
||||
},
|
||||
);
|
||||
process.stdout.write(output);
|
||||
@@ -597,9 +597,9 @@ async function cmdRender(args: string[]): Promise<void> {
|
||||
try {
|
||||
const hash = resolveHash(input as string, varStore);
|
||||
const output = await renderAsync(store, hash, {
|
||||
resolution,
|
||||
decay,
|
||||
epsilon,
|
||||
...(resolution !== undefined && { resolution }),
|
||||
...(decay !== undefined && { decay }),
|
||||
...(epsilon !== undefined && { epsilon }),
|
||||
varStore,
|
||||
});
|
||||
// Output to stdout without JSON wrapping (raw output)
|
||||
@@ -768,9 +768,9 @@ async function cmdVarTag(args: string[]): Promise<void> {
|
||||
const { tags, labels, deleteNames } = parseTagsLabels(tagArgs);
|
||||
|
||||
const variable = varStore.tag(name, schema, {
|
||||
add: Object.keys(tags).length > 0 ? tags : undefined,
|
||||
addLabels: labels.length > 0 ? labels : undefined,
|
||||
delete: deleteNames.length > 0 ? deleteNames : undefined,
|
||||
...(Object.keys(tags).length > 0 && { add: tags }),
|
||||
...(labels.length > 0 && { addLabels: labels }),
|
||||
...(deleteNames.length > 0 && { delete: deleteNames }),
|
||||
});
|
||||
|
||||
await out(
|
||||
@@ -1041,7 +1041,7 @@ async function cmdTemplateDelete(args: string[]): Promise<void> {
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof VariableNotFoundError) {
|
||||
die(`Error: Template not found for schema: ${schemaHash}`);
|
||||
die(`Error: Template not found for schema: ${schemaInput}`);
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
"composite": false,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user