Skip to content

Commit bbb877d

Browse files
docs: re-structuring and grammar
1 parent 3531014 commit bbb877d

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/pages/docs/resources/typescript.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ The below steps will help you get up and running with TypeScript in your Greenwo
4848

4949
<!-- prettier-ignore-end -->
5050

51-
## Type Imports
52-
53-
Due to how bundlers and other [type-aware tools interpret importing types](https://github.com/ProjectEvergreen/greenwood/issues/1576#issuecomment-3795821236), when doing any `type` based imports, you will need to make sure the type is on the _outside_.
54-
55-
Example:
56-
57-
```ts
58-
// ✅ DO THIS
59-
import type { Page } from "@greenwood/cli";
60-
61-
// ❌ NOT THIS
62-
import { type Page } from "@greenwood/cli";
63-
```
64-
65-
> There is a helpful [**typescript-eslint**](https://typescript-eslint.io/rules/no-import-type-side-effects/) rule for ensuring predictable behaviors around this syntax.
66-
6751
## Types
6852

6953
### Configuration
@@ -109,3 +93,19 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h
10993
</app-ctc-block>
11094

11195
<!-- prettier-ignore-end -->
96+
97+
## Type Imports
98+
99+
Due to how bundlers and other [type-aware tools handle type based imports](https://github.com/ProjectEvergreen/greenwood/issues/1576#issuecomment-3795821236), you will need to make sure the `type` is at the _**top level**_ of the import statement to prevent side-effect imports from being included in your bundles.
100+
101+
Example:
102+
103+
```ts
104+
// ✅ DO THIS
105+
import type { Page } from "@greenwood/cli";
106+
107+
// ❌ NOT THIS
108+
import { type Page } from "@greenwood/cli";
109+
```
110+
111+
> There is a helpful [**typescript-eslint** rule](https://typescript-eslint.io/rules/no-import-type-side-effects/) for ensuring predictable behaviors around this syntax.

0 commit comments

Comments
 (0)