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
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,37 @@ function enhanceIfNecessary(diagnostic: Diagnostic): Diagnostic {
message:
'Type definitions are missing for this Svelte Component. ' +
// eslint-disable-next-line max-len
'It needs a class definition with at least the property \'$$prop_def\' which should contain a map of input property definitions.\n' +
"It needs a class definition with at least the property '$$prop_def' which should contain a map of input property definitions.\n" +
'Example:\n' +
'class ComponentName { $$prop_def: { propertyName: string; } }\n\n' +
' class ComponentName { $$prop_def: { propertyName: string; } }\n' +
'If you are using Svelte 3.31+, use SvelteComponentTyped:\n' +
' import type { SvelteComponentTyped } from "svelte";\n' +
' class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}\n\n' +
'Underlying error:\n' +
diagnostic.message
};
}

if (diagnostic.code === 2607) {
return {
...diagnostic,
message:
'Element does not support attributes because ' +
'type definitions are missing for this Svelte Component or element cannot be used as such.\n\n' +
'Underlying error:\n' +
diagnostic.message
};
}

if (diagnostic.code === 1184) {
return {
...diagnostic,
message:
diagnostic.message +
'\nIf this is a declare statement, move it into <script context="module">..</script>'
};
}

return diagnostic;
}

Expand Down