From 7eb1bb9d39645668775ff962120651063afb5980 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 24 Jan 2026 21:02:42 -0500 Subject: [PATCH 1/6] docs: document caveat with greenwood nested type imports --- src/pages/docs/resources/typescript.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index e6fbdec1..2d25c8f8 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -95,3 +95,17 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h + +## Type Imports + +Due to a [known issue in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood's types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. + +Example: + +```ts +// ✅ DO THIS +import type { Page } from "@greenwood/cli"; + +// ❌ NOT THIS +import { type Page } from "@greenwood/cli"; +``` From bf11882ec3c866770249003c4e9ac4621fba13ed Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 24 Jan 2026 21:03:58 -0500 Subject: [PATCH 2/6] docs: document caveat with greenwood nested type imports --- src/pages/docs/resources/typescript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index 2d25c8f8..95331177 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -98,7 +98,7 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h ## Type Imports -Due to a [known issue in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood's types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. +Due to a [known issue in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. Example: From 5e48d0d091edca35a8b9b62b4a528e237166bbb8 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 24 Jan 2026 21:16:45 -0500 Subject: [PATCH 3/6] docs: document caveat with greenwood nested type imports --- src/pages/docs/resources/typescript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index 95331177..948d7e1e 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -98,7 +98,7 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h ## Type Imports -Due to a [known issue in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. +Due to a [known "issue" in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. Example: From 3531014048d750988d9a66e8bad8a57059df3e04 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 14 Feb 2026 09:23:02 -0500 Subject: [PATCH 4/6] docs: document nested type imports hazard --- src/pages/docs/resources/typescript.md | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index 948d7e1e..775493a9 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -48,6 +48,22 @@ The below steps will help you get up and running with TypeScript in your Greenwo +## Type Imports + +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_. + +Example: + +```ts +// ✅ DO THIS +import type { Page } from "@greenwood/cli"; + +// ❌ NOT THIS +import { type Page } from "@greenwood/cli"; +``` + +> There is a helpful [**typescript-eslint**](https://typescript-eslint.io/rules/no-import-type-side-effects/) rule for ensuring predictable behaviors around this syntax. + ## Types ### Configuration @@ -72,8 +88,6 @@ In addition to being able to author your components, SSR pages, and API routes i -> We recommend putting the `type` on the outside of the braces to avoid [inadvertent bundling](https://github.com/ProjectEvergreen/greenwood/issues/1576) of the package your importing from. - See our [reference docs on Greenwood's available types](/docs/reference/appendix/#types) for more information on authoring with TypeScript. ### Import Attributes @@ -95,17 +109,3 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h - -## Type Imports - -Due to a [known "issue" in NodeJS](https://github.com/nodejs/node/issues/58422), when doing `type` based imports for [Greenwood types](https://github.com/ProjectEvergreen/greenwood/issues/1576), it will be required to _**not**_ use nested type imports. - -Example: - -```ts -// ✅ DO THIS -import type { Page } from "@greenwood/cli"; - -// ❌ NOT THIS -import { type Page } from "@greenwood/cli"; -``` From bbb877d0605a8b96db29e8313e80142e6b4aab31 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 14 Feb 2026 12:37:23 -0500 Subject: [PATCH 5/6] docs: re-structuring and grammar --- src/pages/docs/resources/typescript.md | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index 775493a9..5e5fface 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -48,22 +48,6 @@ The below steps will help you get up and running with TypeScript in your Greenwo -## Type Imports - -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_. - -Example: - -```ts -// ✅ DO THIS -import type { Page } from "@greenwood/cli"; - -// ❌ NOT THIS -import { type Page } from "@greenwood/cli"; -``` - -> There is a helpful [**typescript-eslint**](https://typescript-eslint.io/rules/no-import-type-side-effects/) rule for ensuring predictable behaviors around this syntax. - ## Types ### Configuration @@ -109,3 +93,19 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h + +## Type Imports + +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. + +Example: + +```ts +// ✅ DO THIS +import type { Page } from "@greenwood/cli"; + +// ❌ NOT THIS +import { type Page } from "@greenwood/cli"; +``` + +> There is a helpful [**typescript-eslint** rule](https://typescript-eslint.io/rules/no-import-type-side-effects/) for ensuring predictable behaviors around this syntax. From 76797c95a5d3400931de14293014f4c2cf7bb3f6 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Wed, 18 Feb 2026 21:57:02 -0500 Subject: [PATCH 6/6] docs: final drafting --- src/pages/docs/resources/typescript.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/docs/resources/typescript.md b/src/pages/docs/resources/typescript.md index 5e5fface..488c5c78 100644 --- a/src/pages/docs/resources/typescript.md +++ b/src/pages/docs/resources/typescript.md @@ -96,9 +96,7 @@ Currently TypeScript only supports types for standard [JSON Import Attributes](h ## Type Imports -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. - -Example: +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` qualifier is at the _**top level**_ of the import statement so as to prevent side-effectful import statements from being left behind and included in your bundles. ```ts // ✅ DO THIS