Skip to content

Commit a84be26

Browse files
chore(snc): fix some snc errors in transpile-module.ts (#5748)
1 parent 9d967c8 commit a84be26

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/compiler/transformers/static-to-meta/visitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const convertStaticToMeta = (
1313
compilerCtx: d.CompilerCtx,
1414
buildCtx: d.BuildCtx,
1515
typeChecker: ts.TypeChecker,
16-
collection: d.CollectionCompilerMeta,
16+
collection: d.CollectionCompilerMeta | null,
1717
transformOpts: d.TransformOptions,
1818
): ts.TransformerFactory<ts.SourceFile> => {
1919
return (transformCtx) => {

src/compiler/transpile/transpile-module.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ export const transpileModule = (
111111
const program = ts.createProgram([sourceFilePath], tsCompilerOptions, compilerHost);
112112
const typeChecker = program.getTypeChecker();
113113

114-
const transformers: ts.CustomTransformers = {
114+
const transformers = {
115115
before: [
116116
convertDecoratorsToStatic(config, buildCtx.diagnostics, typeChecker, program),
117117
performAutomaticKeyInsertion,
118118
updateStencilCoreImports(transformOpts.coreImportPath),
119119
],
120120
after: [convertStaticToMeta(config, compilerCtx, buildCtx, typeChecker, null, transformOpts)],
121-
afterDeclarations: [],
122-
};
121+
afterDeclarations: [] as (ts.CustomTransformerFactory | ts.TransformerFactory<ts.SourceFile | ts.Bundle>)[],
122+
} satisfies ts.CustomTransformers;
123123

124124
if (config.transformAliasedImportPaths) {
125125
transformers.before.push(rewriteAliasedSourceFileImportPaths);
@@ -146,7 +146,7 @@ export const transpileModule = (
146146

147147
program.emit(undefined, undefined, undefined, false, transformers);
148148

149-
const tsDiagnostics = [...program.getSyntacticDiagnostics()];
149+
const tsDiagnostics = [...program.getSyntacticDiagnostics()] as ts.Diagnostic[];
150150

151151
if (config.validateTypes) {
152152
tsDiagnostics.push(...program.getOptionsDiagnostics());
@@ -156,15 +156,15 @@ export const transpileModule = (
156156

157157
results.diagnostics.push(...buildCtx.diagnostics);
158158

159-
results.moduleFile = compilerCtx.moduleMap.get(results.sourceFilePath);
159+
results.moduleFile = compilerCtx.moduleMap.get(results.sourceFilePath)!;
160160

161161
return results;
162162
};
163163

164164
const getScriptTargetKind = (transformOpts: d.TransformOptions) => {
165165
const target = transformOpts.target && transformOpts.target.toUpperCase();
166-
if (isNumber((ts.ScriptTarget as any)[target])) {
167-
return (ts.ScriptTarget as any)[target];
166+
if (isNumber((ts.ScriptTarget as any)[target as string])) {
167+
return (ts.ScriptTarget as any)[target as string];
168168
}
169169
// ESNext and Latest are the same
170170
return ts.ScriptTarget.Latest;

0 commit comments

Comments
 (0)