Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script lang="ts">
export let flag = false;
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
import Component from './Component.svelte'
</script>

<Component flag />
10 changes: 9 additions & 1 deletion packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ export class ExportedNames {
const jsDocType = ts.getJSDocType(declaration);
const type = tsType || jsDocType;

if (!ts.isIdentifier(identifier) || !type) {
if (
!ts.isIdentifier(identifier) ||
(!type &&
// Edge case: TS infers `export let bla = false` to type `false`.
// prevent that by adding the any-wrap in this case, too.
![ts.SyntaxKind.FalseKeyword, ts.SyntaxKind.TrueKeyword].includes(
declaration.initializer?.kind
))
) {
return;
}
const name = identifier.getText();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
///<reference types="svelte" />
<></>;function render() {

let bla = false;
let blubb = true;
let bla = false/*Ωignore_startΩ*/;bla = __sveltets_1_any(bla);/*Ωignore_endΩ*/;
let blubb = true/*Ωignore_startΩ*/;blubb = __sveltets_1_any(blubb);/*Ωignore_endΩ*/;
let bla1: boolean = false/*Ωignore_startΩ*/;bla1 = __sveltets_1_any(bla1);/*Ωignore_endΩ*/;
let blubb1: boolean = true/*Ωignore_startΩ*/;blubb1 = __sveltets_1_any(blubb1);/*Ωignore_endΩ*/;
let a1 = true;let a2 = false;let b1: boolean = true/*Ωignore_startΩ*/;b1 = __sveltets_1_any(b1);/*Ωignore_endΩ*/;let b2: boolean = false/*Ωignore_startΩ*/;b2 = __sveltets_1_any(b2);/*Ωignore_endΩ*/;
let a1 = true/*Ωignore_startΩ*/;a1 = __sveltets_1_any(a1);/*Ωignore_endΩ*/;let a2 = false/*Ωignore_startΩ*/;a2 = __sveltets_1_any(a2);/*Ωignore_endΩ*/;let b1: boolean = true/*Ωignore_startΩ*/;b1 = __sveltets_1_any(b1);/*Ωignore_endΩ*/;let b2: boolean = false/*Ωignore_startΩ*/;b2 = __sveltets_1_any(b2);/*Ωignore_endΩ*/;
;
() => (<></>);
return { props: {bla: bla , blubb: blubb , bla1: bla1 , blubb1: blubb1 , a1: a1 , a2: a2 , b1: b1 , b2: b2} as {bla?: typeof bla, blubb?: typeof blubb, bla1?: boolean, blubb1?: boolean, a1?: typeof a1, a2?: typeof a2, b1?: boolean, b2?: boolean}, slots: {}, getters: {}, events: {} }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
///<reference types="svelte" />
;function render() {

let bla = false;
let blubb = true;
let bla = false/*Ωignore_startΩ*/;bla = __sveltets_1_any(bla);/*Ωignore_endΩ*/;
let blubb = true/*Ωignore_startΩ*/;blubb = __sveltets_1_any(blubb);/*Ωignore_endΩ*/;
let bla1: boolean = false/*Ωignore_startΩ*/;bla1 = __sveltets_1_any(bla1);/*Ωignore_endΩ*/;
let blubb1: boolean = true/*Ωignore_startΩ*/;blubb1 = __sveltets_1_any(blubb1);/*Ωignore_endΩ*/;
let a1 = true;let a2 = false;let b1: boolean = true/*Ωignore_startΩ*/;b1 = __sveltets_1_any(b1);/*Ωignore_endΩ*/;let b2: boolean = false/*Ωignore_startΩ*/;b2 = __sveltets_1_any(b2);/*Ωignore_endΩ*/;
let a1 = true/*Ωignore_startΩ*/;a1 = __sveltets_1_any(a1);/*Ωignore_endΩ*/;let a2 = false/*Ωignore_startΩ*/;a2 = __sveltets_1_any(a2);/*Ωignore_endΩ*/;let b1: boolean = true/*Ωignore_startΩ*/;b1 = __sveltets_1_any(b1);/*Ωignore_endΩ*/;let b2: boolean = false/*Ωignore_startΩ*/;b2 = __sveltets_1_any(b2);/*Ωignore_endΩ*/;
;
async () => {};
return { props: {bla: bla , blubb: blubb , bla1: bla1 , blubb1: blubb1 , a1: a1 , a2: a2 , b1: b1 , b2: b2} as {bla?: typeof bla, blubb?: typeof blubb, bla1?: boolean, blubb1?: boolean, a1?: typeof a1, a2?: typeof a2, b1?: boolean, b2?: boolean}, slots: {}, getters: {}, events: {} }}
Expand Down