TypeScript
svelte-check checks every tag and attribute. The types are generated from TypeScript's
built-in Web Audio types.
What is checked
- Tag names, and attribute values against each node's types.
- AudioParams take numbers, or number strings.
- Read-only properties and methods are not attributes.
- Required creation options, such as
feedforwardoniirFilter.
<oscillator type="sin"></oscillator>
<!-- Type '"sin"' is not assignable to type 'OscillatorType'. Did you mean '"sine"'? -->Loading the types
The types load as soon as any file in your project imports svelte-audio-renderer. If
your audio components don't import anything from the package, add a reference:
/// <reference types="svelte-audio-renderer" />ESLint
ESLint doesn't see these types, so typed lint rules treat {@attach (el) => …} and
event parameters in markup as any. Define those functions in the script, with types.