Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
}));
}

const typecheckFile = (id: string, snapshot: tsTypes.IScriptSnapshot, tcContext: IContext) =>
const typecheckFile = (id: string, snapshot: tsTypes.IScriptSnapshot | undefined, tcContext: IContext) =>
{
id = normalize(id);
checkedFiles.add(id); // must come before print, as that could bail
if (!snapshot)
return;

const diagnostics = getDiagnostics(id, snapshot);
printDiagnostics(tcContext, diagnostics, parsedConfig.options.pretty !== false);
id = normalize(id);
checkedFiles.add(id); // must come before print, as that could bail

if (diagnostics.length > 0)
noErrors = false;
const diagnostics = getDiagnostics(id, snapshot);
printDiagnostics(tcContext, diagnostics, parsedConfig.options.pretty !== false);

if (diagnostics.length > 0)
noErrors = false;
}

/** to be called at the end of Rollup's build phase, before output generation */
Expand Down Expand Up @@ -289,8 +292,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
return;

const snapshot = servicesHost.getScriptSnapshot(id);
if (snapshot)
typecheckFile(id, snapshot, context);
typecheckFile(id, snapshot, context);
});
}

Expand All @@ -304,10 +306,8 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
return;

context.debug(() => `type-checking missed '${key}'`);

const snapshot = servicesHost.getScriptSnapshot(key);
if (snapshot)
typecheckFile(key, snapshot, contextWrapper);
typecheckFile(key, snapshot, contextWrapper);
});

buildDone();
Expand Down