File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
packages/language-server/src/plugins/typescript/features Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,37 @@ function enhanceIfNecessary(diagnostic: Diagnostic): Diagnostic {
130130 message :
131131 'Type definitions are missing for this Svelte Component. ' +
132132 // eslint-disable-next-line max-len
133- ' It needs a class definition with at least the property \ '$$prop_def\ ' which should contain a map of input property definitions.\n' +
133+ " It needs a class definition with at least the property '$$prop_def' which should contain a map of input property definitions.\n" +
134134 'Example:\n' +
135- 'class ComponentName { $$prop_def: { propertyName: string; } }\n\n' +
135+ ' class ComponentName { $$prop_def: { propertyName: string; } }\n' +
136+ 'If you are using Svelte 3.31+, use SvelteComponentTyped:\n' +
137+ ' import type { SvelteComponentTyped } from "svelte";\n' +
138+ ' class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}\n\n' +
139+ 'Underlying error:\n' +
136140 diagnostic . message
137141 } ;
138142 }
139143
144+ if ( diagnostic . code === 2607 ) {
145+ return {
146+ ...diagnostic ,
147+ message :
148+ 'Element does not support attributes because ' +
149+ 'type definitions are missing for this Svelte Component or element cannot be used as such.\n\n' +
150+ 'Underlying error:\n' +
151+ diagnostic . message
152+ } ;
153+ }
154+
155+ if ( diagnostic . code === 1184 ) {
156+ return {
157+ ...diagnostic ,
158+ message :
159+ diagnostic . message +
160+ '\nIf this is a declare statement, move it into <script context="module">..</script>'
161+ } ;
162+ }
163+
140164 return diagnostic ;
141165}
142166
You can’t perform that action at this time.
0 commit comments