Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function preprocessSvelteFile(document: Document, options: SvelteSnapshotOptions
} catch (e: any) {
// Error start/end logic is different and has different offsets for line, so we need to convert that
const start: Position = {
line: e.start?.line - 1 ?? 0,
line: (e.start?.line ?? 1) - 1,
character: e.start?.column ?? 0
};
const end: Position = e.end ? { line: e.end.line - 1, character: e.end.column } : start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ function checkIfImportIsEventDispatcher(node: ts.ImportDeclaration): string | un
}

const namedImports = node.importClause?.namedBindings;
if (ts.isNamedImports(namedImports)) {
if (namedImports && ts.isNamedImports(namedImports)) {
const eventDispatcherImport = namedImports.elements.find(
// If it's an aliased import, propertyName is set
(el) => (el.propertyName || el.name).text === 'createEventDispatcher'
Expand Down