
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
svelte2tsx
Advanced tools
Converts Svelte component source into TSX. The TSX can be type checked using the included svelte-jsx.d.ts and svelte-shims.d.ts.
This project only converts svelte to tsx, type checking is left to consumers of this plugin such as language services
type SvelteCompiledToTsx = {
code: string;
map: import('magic-string').SourceMap;
};
export default function svelte2tsx(svelte: string): SvelteCompiledToTsx;
For example
Input.svelte
<script>
export let world = 'name';
</script>
<h1>hello {world}</h1>
will produce this ugly but type checkable TSX
<></>;
function render() {
let world = 'name';
<>
<h1>hello {world}</h1>
</>;
return { props: { world }, slots: {}, events: {} };
}
export default class _World_ extends __sveltets_1_createSvelte2TsxComponent(
__sveltets_1_partial(__sveltets_1_with_any_event(render))
) {}
with a v3 SourceMap back to the original source.
For more examples of the transformations, see the test/**/samples folders
svelte2tsxsvelte-preprocess is a package that allows you to use various preprocessors with Svelte, including TypeScript. While it doesn't convert Svelte to TSX, it enables the use of TypeScript directly within Svelte components, providing type checking and autocompletion.
svelte-check is a command-line tool that provides type checking and linting for Svelte projects. It uses the TypeScript compiler to check Svelte components for type errors, similar to what svelte2tsx achieves by converting to TSX.
svelte-language-server is a language server for Svelte that provides IDE features like autocompletion, go-to-definition, and type checking. It integrates with editors like VSCode to enhance the development experience for Svelte projects.
FAQs
Convert Svelte components to TSX for type checking
The npm package svelte2tsx receives a total of 265,406 weekly downloads. As such, svelte2tsx popularity was classified as popular.
We found that svelte2tsx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.