svelte2tsx
Convert Svelte components to TSX for type checking
Last updated 4 years ago by svelte-language-tools-deploy .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install svelte2tsx 
SYNC missed versions from official npm registry.

svelte2tsx

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_2_createSvelte2TsxComponent(
    __sveltets_2_partial(__sveltets_2_with_any_event(render))
) {}

with a v3 SourceMap back to the original source.

For more examples of the transformations, see the test/**/samples folders

Credits

  • halfnelson for creating svelte2tsx
  • pushkine for creating the source mapping test infrastructure

Current Tags

  • 0.7.19                                ...           latest (2 months ago)

284 Versions

  • 0.7.19                                ...           2 months ago
  • 0.7.18                                ...           2 months ago
  • 0.7.17                                ...           2 months ago
  • 0.7.16                                ...           3 months ago
  • 0.7.15                                ...           4 months ago
  • 0.7.14                                ...           4 months ago
  • 0.7.13                                ...           5 months ago
  • 0.7.12                                ...           5 months ago
  • 0.7.11                                ...           5 months ago
  • 0.7.10                                ...           5 months ago
  • 0.7.9                                ...           6 months ago
  • 0.7.8                                ...           6 months ago
  • 0.7.7                                ...           7 months ago
  • 0.7.6                                ...           7 months ago
  • 0.7.5                                ...           8 months ago
  • 0.7.4                                ...           8 months ago
  • 0.7.3                                ...           9 months ago
  • 0.7.2                                ...           9 months ago
  • 0.7.1                                ...           9 months ago
  • 0.7.0                                ...           10 months ago
  • 0.6.27                                ...           a year ago
  • 0.6.26                                ...           a year ago
  • 0.6.25                                ...           a year ago
  • 0.6.24                                ...           a year ago
  • 0.6.23                                ...           a year ago
  • 0.6.22                                ...           a year ago
  • 0.6.21                                ...           a year ago
  • 0.6.20                                ...           a year ago
  • 0.6.19                                ...           a year ago
  • 0.6.18                                ...           a year ago
  • 0.6.17                                ...           a year ago
  • 0.6.16                                ...           a year ago
  • 0.6.15                                ...           a year ago
  • 0.6.14                                ...           2 years ago
  • 0.6.13                                ...           2 years ago
  • 0.6.12                                ...           2 years ago
  • 0.6.11                                ...           2 years ago
  • 0.6.10                                ...           2 years ago
  • 0.6.9                                ...           2 years ago
  • 0.6.8                                ...           2 years ago
  • 0.6.7                                ...           2 years ago
  • 0.6.6                                ...           2 years ago
  • 0.6.5                                ...           2 years ago
  • 0.6.4                                ...           2 years ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.23                                ...           2 years ago
  • 0.5.22                                ...           2 years ago
  • 0.5.21                                ...           2 years ago
  • 0.5.20                                ...           2 years ago
  • 0.5.19                                ...           2 years ago
  • 0.5.18                                ...           2 years ago
  • 0.5.17                                ...           2 years ago
  • 0.5.16                                ...           2 years ago
  • 0.5.15                                ...           2 years ago
  • 0.5.14                                ...           2 years ago
  • 0.5.13                                ...           2 years ago
  • 0.5.12                                ...           2 years ago
  • 0.5.11                                ...           2 years ago
  • 0.5.10                                ...           3 years ago
  • 0.5.9                                ...           3 years ago
  • 0.5.8                                ...           3 years ago
  • 0.5.7                                ...           3 years ago
  • 0.5.6                                ...           3 years ago
  • 0.5.5                                ...           3 years ago
  • 0.5.4                                ...           3 years ago
  • 0.5.3                                ...           3 years ago
  • 0.5.2                                ...           3 years ago
  • 0.5.1                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.14                                ...           3 years ago
  • 0.4.13                                ...           3 years ago
  • 0.4.12                                ...           3 years ago
  • 0.4.11                                ...           3 years ago
  • 0.4.10                                ...           3 years ago
  • 0.4.9                                ...           3 years ago
  • 0.4.8                                ...           3 years ago
  • 0.4.7                                ...           3 years ago
  • 0.4.6                                ...           3 years ago
  • 0.4.5                                ...           3 years ago
  • 0.4.4                                ...           3 years ago
  • 0.4.3                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.193                                ...           3 years ago
  • 0.1.192                                ...           3 years ago
  • 0.1.191                                ...           4 years ago
  • 0.1.190                                ...           4 years ago
  • 0.1.189                                ...           4 years ago
  • 0.1.188                                ...           4 years ago
  • 0.1.187                                ...           4 years ago
  • 0.1.186                                ...           4 years ago
  • 0.1.185                                ...           4 years ago
  • 0.1.184                                ...           4 years ago
  • 0.1.183                                ...           4 years ago
  • 0.1.182                                ...           4 years ago
  • 0.1.181                                ...           4 years ago
  • 0.1.180                                ...           4 years ago
  • 0.1.179                                ...           4 years ago
  • 0.1.178                                ...           4 years ago
  • 0.1.177                                ...           4 years ago
  • 0.1.176                                ...           4 years ago
  • 0.1.175                                ...           4 years ago
  • 0.1.174                                ...           4 years ago
  • 0.1.173                                ...           4 years ago
  • 0.1.172                                ...           4 years ago
  • 0.1.171                                ...           4 years ago
  • 0.1.170                                ...           4 years ago
  • 0.1.169                                ...           4 years ago
  • 0.1.168                                ...           4 years ago
  • 0.1.167                                ...           4 years ago
  • 0.1.166                                ...           4 years ago
  • 0.1.165                                ...           4 years ago
  • 0.1.164                                ...           4 years ago
  • 0.1.163                                ...           4 years ago
  • 0.1.162                                ...           4 years ago
  • 0.1.161                                ...           4 years ago
  • 0.1.160                                ...           4 years ago
  • 0.1.159                                ...           4 years ago
  • 0.1.158                                ...           4 years ago
  • 0.1.157                                ...           4 years ago
  • 0.1.156                                ...           4 years ago
  • 0.1.155                                ...           4 years ago
  • 0.1.154                                ...           4 years ago
  • 0.1.153                                ...           4 years ago
  • 0.1.152                                ...           4 years ago
  • 0.1.151                                ...           4 years ago
  • 0.1.150                                ...           4 years ago
  • 0.1.149                                ...           4 years ago
  • 0.1.148                                ...           4 years ago
  • 0.1.147                                ...           4 years ago
  • 0.1.146                                ...           4 years ago
  • 0.1.145                                ...           4 years ago
  • 0.1.144                                ...           4 years ago
  • 0.1.143                                ...           4 years ago
  • 0.1.142                                ...           4 years ago
  • 0.1.141                                ...           4 years ago
  • 0.1.140                                ...           4 years ago
  • 0.1.139                                ...           4 years ago
  • 0.1.138                                ...           4 years ago
  • 0.1.137                                ...           4 years ago
  • 0.1.136                                ...           4 years ago
  • 0.1.135                                ...           4 years ago
  • 0.1.134                                ...           4 years ago
  • 0.1.133                                ...           4 years ago
  • 0.1.132                                ...           4 years ago
  • 0.1.131                                ...           4 years ago
  • 0.1.130                                ...           4 years ago
  • 0.1.129                                ...           4 years ago
  • 0.1.128                                ...           4 years ago
  • 0.1.127                                ...           4 years ago
  • 0.1.126                                ...           4 years ago
  • 0.1.125                                ...           4 years ago
  • 0.1.124                                ...           4 years ago
  • 0.1.123                                ...           4 years ago
  • 0.1.122                                ...           4 years ago
  • 0.1.121                                ...           4 years ago
  • 0.1.120                                ...           4 years ago
  • 0.1.119                                ...           4 years ago
  • 0.1.118                                ...           4 years ago
  • 0.1.117                                ...           4 years ago
  • 0.1.116                                ...           4 years ago
  • 0.1.115                                ...           4 years ago
  • 0.1.114                                ...           4 years ago
  • 0.1.113                                ...           4 years ago
  • 0.1.112                                ...           4 years ago
  • 0.1.111                                ...           4 years ago
  • 0.1.110                                ...           4 years ago
  • 0.1.109                                ...           4 years ago
  • 0.1.108                                ...           4 years ago
  • 0.1.107                                ...           4 years ago
  • 0.1.106                                ...           4 years ago
  • 0.1.105                                ...           4 years ago
  • 0.1.104                                ...           4 years ago
  • 0.1.103                                ...           4 years ago
  • 0.1.102                                ...           4 years ago
  • 0.1.101                                ...           4 years ago
  • 0.1.100                                ...           4 years ago
  • 0.1.99                                ...           4 years ago
  • 0.1.98                                ...           4 years ago
  • 0.1.97                                ...           4 years ago
  • 0.1.96                                ...           4 years ago
  • 0.1.95                                ...           4 years ago
  • 0.1.94                                ...           4 years ago
  • 0.1.93                                ...           4 years ago
  • 0.1.92                                ...           4 years ago
  • 0.1.91                                ...           4 years ago
  • 0.1.90                                ...           4 years ago
  • 0.1.89                                ...           4 years ago
  • 0.1.88                                ...           4 years ago
  • 0.1.87                                ...           4 years ago
  • 0.1.86                                ...           4 years ago
  • 0.1.85                                ...           4 years ago
  • 0.1.84                                ...           4 years ago
  • 0.1.83                                ...           4 years ago
  • 0.1.82                                ...           4 years ago
  • 0.1.81                                ...           4 years ago
  • 0.1.80                                ...           4 years ago
  • 0.1.79                                ...           4 years ago
  • 0.1.78                                ...           4 years ago
  • 0.1.77                                ...           4 years ago
  • 0.1.76                                ...           4 years ago
  • 0.1.75                                ...           4 years ago
  • 0.1.74                                ...           4 years ago
  • 0.1.73                                ...           4 years ago
  • 0.1.72                                ...           4 years ago
  • 0.1.71                                ...           4 years ago
  • 0.1.70                                ...           4 years ago
  • 0.1.69                                ...           4 years ago
  • 0.1.68                                ...           4 years ago
  • 0.1.67                                ...           4 years ago
  • 0.1.66                                ...           4 years ago
  • 0.1.65                                ...           4 years ago
  • 0.1.64                                ...           4 years ago
  • 0.1.63                                ...           4 years ago
  • 0.1.62                                ...           4 years ago
  • 0.1.61                                ...           4 years ago
  • 0.1.60                                ...           4 years ago
  • 0.1.59                                ...           4 years ago
  • 0.1.58                                ...           4 years ago
  • 0.1.57                                ...           4 years ago
  • 0.1.56                                ...           4 years ago
  • 0.1.55                                ...           4 years ago
  • 0.1.54                                ...           4 years ago
  • 0.1.53                                ...           4 years ago
  • 0.1.52                                ...           4 years ago
  • 0.1.51                                ...           4 years ago
  • 0.1.50                                ...           4 years ago
  • 0.1.49                                ...           4 years ago
  • 0.1.48                                ...           4 years ago
  • 0.1.47                                ...           4 years ago
  • 0.1.46                                ...           4 years ago
  • 0.1.45                                ...           4 years ago
  • 0.1.44                                ...           4 years ago
  • 0.1.43                                ...           4 years ago
  • 0.1.42                                ...           4 years ago
  • 0.1.41                                ...           4 years ago
  • 0.1.40                                ...           4 years ago
  • 0.1.39                                ...           4 years ago
  • 0.1.38                                ...           4 years ago
  • 0.1.37                                ...           4 years ago
  • 0.1.36                                ...           4 years ago
  • 0.1.35                                ...           4 years ago
  • 0.1.34                                ...           4 years ago
  • 0.1.33                                ...           4 years ago
  • 0.1.32                                ...           4 years ago
  • 0.1.31                                ...           4 years ago
  • 0.1.30                                ...           4 years ago
  • 0.1.29                                ...           4 years ago
  • 0.1.28                                ...           4 years ago
  • 0.1.27                                ...           4 years ago
  • 0.1.26                                ...           4 years ago
  • 0.1.25                                ...           4 years ago
  • 0.1.24                                ...           4 years ago
  • 0.1.23                                ...           4 years ago
  • 0.1.22                                ...           4 years ago
  • 0.1.21                                ...           4 years ago
  • 0.1.20                                ...           4 years ago
  • 0.1.19                                ...           4 years ago
  • 0.1.18                                ...           4 years ago
  • 0.1.17                                ...           4 years ago
  • 0.1.16                                ...           4 years ago
  • 0.1.15                                ...           4 years ago
  • 0.1.14                                ...           4 years ago
  • 0.1.13                                ...           4 years ago
  • 0.1.12                                ...           4 years ago
  • 0.1.11                                ...           4 years ago
  • 0.1.10                                ...           4 years ago
  • 0.1.9                                ...           4 years ago
  • 0.1.8                                ...           4 years ago
  • 0.1.7                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (20)

© 2010 - cnpmjs.org x YWFE | Home | YWFE