Skip to content

svelte-kit package doesn't remove lang="ts" attribute from <script> tags #1843

@GrygrFlzr

Description

@GrygrFlzr

Describe the bug
svelte-kit package on a TypeScript project doesn't remove lang="ts" attribute from <script> tags. The code is transformed from TS to JS, though.

To Reproduce

npm init svelte@next
# choose demo
# choose typescript
# choose whatever for prettier/eslint
npm i
npm i -D svelte2tsx
npx svelte-kit package

Produces the following package/Counter/index.svelte script tag:

<script lang="ts">import { spring } from 'svelte/motion';
let count = 0;
const displayed_count = spring();
$: displayed_count.set(count);
$: offset = modulo($displayed_count, 1);
function modulo(n, m) {
    // handle negative numbers
    return ((n % m) + m) % m;
}
</script>

Expected behavior
Remove the lang="ts" attribute from <script> tags.

Information about your SvelteKit Installation:

Diagnostics
  System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 9.93 GB / 31.93 GB
  Binaries:
    Node: 14.16.0 - C:\program files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.13 - C:\program files\nodejs\npm.CMD
  Browsers:
    Chrome: 91.0.4472.124
    Edge: Spartan (44.22000.1.0), Chromium (91.0.864.59)
    Internet Explorer: 11.0.22000.1
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.122
    svelte: ^3.34.0 => 3.38.3

Severity
Annoyance - requires manual removal for proper publishing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions