github sveltejs/language-tools svelte-check-2.0.0

latest releases: extensions-109.2.2, svelte-check-4.0.7, language-server-0.17.5...
3 years ago
  • (fix) correct attribute name: fill-rule instead of fillRule
  • (fix) more robust mapping for Svelte diagnostics (#1035)
  • (feat) add aria jsx type declarations (#957)
  • (breaking) be more strict with required props (#1030)

Breaking Change

Previously, properties that had no initializer were only required if the user was using both TypeScript and activated strict mode. This is changed now: People using TypeScript, and those using checkJs also in JavaScript files, will always see this behavior now.

The fix is to provide a default value for properties that are optional. That's either the specific value kind or undefined.
Example TS:
export let optional: string;
Becomes
export let optional: string = ''; (or just export let optional = '')
Example JS:
export let optional;
Becomes
export let optional = undefined;

If you don't have control over the code because it's from a library, ask the author of that library to adjust their code. In the meantime you can create a d.ts file where you specify the types yourself.
Example:

<script>
  import { Foo } from 'package';
  import Bar from 'package/File.svelte';
</script>

Create a .d.ts file:

declare module 'package' {
  import { SvelteComponentTyped } from 'svelte';
  export class Foo extends SvelteComponentTyped<{..props definition here..}> {}
}
declare module 'package/File.svelte' {
  import { SvelteComponentTyped } from 'svelte';
  export default class Bar extends SvelteComponentTyped<{..props definition here..}> {}
}

Don't miss a new language-tools release

NewReleases is sending notifications on new releases.