@litsx/typescript
v0.9.0
Published
TypeScript language-service, typecheck, and editor support for LitSX authored syntax
Maintainers
Readme
@litsx/typescript
TypeScript language-service support for LitSX-authored JSX.
The plugin exists to make editor tooling tolerate Lit-flavoured JSX attributes such as:
@click={handle}.value={model.value}?disabled={busy}
Scope
The plugin virtualizes prefixed JSX attribute names into TypeScript-safe names for the language service and then remaps the results back to the authored LitSX syntax.
It provides:
- tolerance for
@event,.propand?attrin.jsx,.tsx,.litsx, and.litsx.jsx - remapped diagnostics and quick info spans
- filtered completions that hide the internal
__litsx_*names - contextual completions for
@event,.propand?attr - authored diagnostics for obviously invalid Lit bindings
- a
litsx-tscCLI path for virtualized type-checking when authored source uses Litsx-specific syntax that plaintsccannot parse directly
It does not provide:
- exhaustive DOM/custom-element semantics for every tag
- editor refactors or quick-fixes
- remapped rename/find-references flows
Usage
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@litsx/core",
"plugins": [
{ "name": "@litsx/typescript" }
]
}
}For a workspace using the local package directly, the same shape works in tsconfig.json:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@litsx/core",
"plugins": [
{
"name": "@litsx/typescript"
}
]
}
}VS Code picks this up through the bundled TypeScript server when the workspace is using the project tsconfig.json.
For VS Code specifically, make sure the workspace is using the local TypeScript SDK and that the syntax server is disabled for this workspace:
{
"js/ts.tsdk.path": "node_modules/typescript/lib",
"typescript.tsserver.useSyntaxServer": "never"
}If @click={...}, .value={...}, or ?disabled={...} still show raw syntax
errors in the editor, the LitSX TypeScript plugin usually is not being loaded
for that file yet.
Exports
@litsx/typescript@litsx/typescript/editor-session@litsx/typescript/virtualization@litsx/typescript/typecheck
The virtualization entrypoint exposes the standalone source virtualization helper used internally by the plugin.
The editor-session entrypoint exposes a project-backed editor service for integrations such as VS Code extensions that need LitSX-aware diagnostics, hover, and completions outside the tsserver plugin host. It complements the tsserver plugin rather than replacing it.
CLI Typecheck
If a project wants CLI type-checking for authored syntax such as @click, .value, ?disabled, or static styles = ..., use the virtualized wrapper instead of calling plain tsc directly:
litsx-tsc -p tsconfig.json --noEmitThis is a toolchain/CI concern, not a replacement for the editor plugin. The editor DX still comes from the tsserver plugin.
