Skip to content

Commit cf3a5d1

Browse files
authored
Update defaultIsBad.md
1 parent dd45b60 commit cf3a5d1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/tips/defaultIsBad.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,18 @@ Default exports expose themselves badly named as `default` in dynamic `import`s
6868
const HighChart = await import('https://code.highcharts.com/js/es-modules/masters/highcharts.src.js');
6969
Highcharts.default.chart('container', { ... }); // Notice `.default`
7070
```
71+
72+
### Needs two lines for non-class / non-function
73+
74+
Can be one statement for function / class e.g.
75+
76+
```ts
77+
export default function() {
78+
}
79+
```
80+
81+
But needs two statements otherwise:
82+
```ts
83+
const foo = 123;
84+
export default foo;
85+
```

0 commit comments

Comments
 (0)