Skip to content

Commit 0f8bd2c

Browse files
committed
site: document export-as (#2559)
1 parent b4cc9f4 commit 0f8bd2c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/01-component-format.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
3535
// these properties can be set externally
3636
export let foo;
3737
export let bar = 'optional default value';
38-
38+
39+
// you can use export { ... as ... } to have
40+
// props whose names are reserved keywords
41+
let clazz;
42+
export { clazz as class };
43+
3944
// this property is readonly externally
4045
export const buzz = 'buzz';
4146
@@ -48,6 +53,13 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
4853
export function instanceMethod() {
4954
alert(foo);
5055
}
56+
57+
// you can also use export { ... as ... } to have
58+
// methods whose names are reserved keywords
59+
function del() {
60+
do_something();
61+
}
62+
export { del as delete };
5163
</script>
5264
```
5365

0 commit comments

Comments
 (0)