@decocms/start 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
  2. package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
  3. package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
  4. package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
  5. package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
  6. package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
  7. package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
  8. package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
  9. package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
  10. package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
  11. package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
  12. package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
  13. package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
  14. package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
  15. package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
  16. package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
  17. package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
  18. package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
  19. package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
  20. package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
  21. package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
  22. package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
  23. package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
  24. package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
  25. package/.cursor/skills/deco-core-architecture/engine.md +220 -0
  26. package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
  27. package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
  28. package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
  29. package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
  30. package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
  31. package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
  32. package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
  33. package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
  34. package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
  35. package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
  36. package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
  37. package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
  38. package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
  39. package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
  40. package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
  41. package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
  42. package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
  43. package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
  44. package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
  45. package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
  46. package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
  47. package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
  48. package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
  49. package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
  50. package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
  51. package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
  52. package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
  53. package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
  54. package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
  55. package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
  56. package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
  57. package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
  58. package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
  59. package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
  60. package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
  61. package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
  62. package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
  63. package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
  64. package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
  65. package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
  66. package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
  67. package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
  68. package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
  69. package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
  70. package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
  71. package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
  72. package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
  73. package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
  74. package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
  75. package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
  76. package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
  77. package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
  78. package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
  79. package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
  80. package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
  81. package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
  82. package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
  83. package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
  84. package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
  85. package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
  86. package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
  87. package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
  88. package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
  89. package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
  90. package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
  91. package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
  92. package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
  93. package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
  94. package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
  95. package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
  96. package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
  97. package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
  98. package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
  99. package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
  100. package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
  101. package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
  102. package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
  103. package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
  104. package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
  105. package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
  106. package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
  107. package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
  108. package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
  109. package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
  110. package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
  111. package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
  112. package/.cursor/skills/find-skills/SKILL.md +133 -0
  113. package/.cursor/skills/incident-report/SKILL.md +179 -0
  114. package/.cursor/skills/incident-report/references/5-whys.md +75 -0
  115. package/.cursor/skills/incident-report/templates/client-report.md +187 -0
  116. package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
  117. package/.cursor/skills/template-skill/SKILL.md +38 -0
  118. package/.github/workflows/release.yml +32 -0
  119. package/.releaserc.json +25 -0
  120. package/CLAUDE.md +135 -0
  121. package/GAP_ANALYSIS.md +224 -0
  122. package/GAP_ANALYSIS_V2.md +1013 -0
  123. package/biome.json +39 -0
  124. package/knip.json +5 -0
  125. package/package.json +87 -0
  126. package/scripts/generate-blocks.ts +69 -0
  127. package/scripts/generate-invoke.ts +378 -0
  128. package/scripts/generate-schema.ts +657 -0
  129. package/src/admin/cors.ts +29 -0
  130. package/src/admin/decofile.ts +72 -0
  131. package/src/admin/index.ts +24 -0
  132. package/src/admin/invoke.ts +163 -0
  133. package/src/admin/liveControls.ts +29 -0
  134. package/src/admin/meta.ts +70 -0
  135. package/src/admin/render.ts +205 -0
  136. package/src/admin/schema.ts +686 -0
  137. package/src/admin/setup.ts +44 -0
  138. package/src/cms/index.ts +59 -0
  139. package/src/cms/loader.ts +180 -0
  140. package/src/cms/registry.ts +162 -0
  141. package/src/cms/resolve.ts +1005 -0
  142. package/src/cms/sectionLoaders.ts +294 -0
  143. package/src/hooks/DecoPageRenderer.tsx +444 -0
  144. package/src/hooks/LazySection.tsx +109 -0
  145. package/src/hooks/LiveControls.tsx +108 -0
  146. package/src/hooks/SectionErrorFallback.tsx +85 -0
  147. package/src/hooks/index.ts +8 -0
  148. package/src/index.ts +5 -0
  149. package/src/matchers/builtins.ts +184 -0
  150. package/src/matchers/posthog.ts +154 -0
  151. package/src/middleware/decoState.ts +55 -0
  152. package/src/middleware/healthMetrics.ts +131 -0
  153. package/src/middleware/index.ts +80 -0
  154. package/src/middleware/liveness.ts +21 -0
  155. package/src/middleware/observability.ts +205 -0
  156. package/src/routes/adminRoutes.ts +83 -0
  157. package/src/routes/cmsRoute.ts +302 -0
  158. package/src/routes/components.tsx +34 -0
  159. package/src/routes/index.ts +15 -0
  160. package/src/sdk/analytics.ts +72 -0
  161. package/src/sdk/cacheHeaders.ts +268 -0
  162. package/src/sdk/cachedLoader.ts +206 -0
  163. package/src/sdk/clx.ts +3 -0
  164. package/src/sdk/cookie.ts +39 -0
  165. package/src/sdk/createInvoke.ts +57 -0
  166. package/src/sdk/csp.ts +59 -0
  167. package/src/sdk/env.ts +27 -0
  168. package/src/sdk/index.ts +63 -0
  169. package/src/sdk/instrumentedFetch.ts +137 -0
  170. package/src/sdk/invoke.ts +133 -0
  171. package/src/sdk/mergeCacheControl.ts +150 -0
  172. package/src/sdk/redirects.ts +217 -0
  173. package/src/sdk/requestContext.ts +184 -0
  174. package/src/sdk/serverTimings.ts +68 -0
  175. package/src/sdk/signal.ts +41 -0
  176. package/src/sdk/sitemap.ts +143 -0
  177. package/src/sdk/urlUtils.ts +117 -0
  178. package/src/sdk/useDevice.ts +82 -0
  179. package/src/sdk/useId.ts +7 -0
  180. package/src/sdk/useScript.ts +101 -0
  181. package/src/sdk/workerEntry.ts +703 -0
  182. package/src/sdk/wrapCaughtErrors.ts +107 -0
  183. package/src/types/index.ts +39 -0
  184. package/src/types/widgets.ts +13 -0
  185. package/tsconfig.json +13 -0
@@ -0,0 +1,330 @@
1
+ # Common TypeScript Fixes - Detailed Patterns
2
+
3
+ ## 1. Props Exports for Deco Sections
4
+
5
+ Deco's admin UI needs to read the Props type to generate the form. Without an export, blocks may fail to render or configure.
6
+
7
+ ### Detection
8
+
9
+ ```bash
10
+ # Find sections/components without exported Props
11
+ grep -r "interface Props" sections/ components/ | grep -v "export"
12
+ ```
13
+
14
+ ### Fix Pattern
15
+
16
+ ```typescript
17
+ // sections/MySection.tsx
18
+
19
+ // WRONG - interface not exported
20
+ interface Props {
21
+ title: string;
22
+ description?: string;
23
+ }
24
+
25
+ // CORRECT - export the interface
26
+ export interface Props {
27
+ title: string;
28
+ description?: string;
29
+ }
30
+
31
+ // Also valid - type alias
32
+ export type Props = {
33
+ title: string;
34
+ description?: string;
35
+ };
36
+ ```
37
+
38
+ ### Deco-Specific Requirements
39
+
40
+ For sections that are used in blocks:
41
+ - Props MUST be exported
42
+ - Props must use serializable types (no functions, classes)
43
+ - Use JSDoc comments for field descriptions in the admin
44
+
45
+ ```typescript
46
+ export interface Props {
47
+ /** @title Page Title */
48
+ /** @description The main heading shown to users */
49
+ title: string;
50
+
51
+ /** @format rich-text */
52
+ content?: string;
53
+ }
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 2. Global Type Declarations
59
+
60
+ Third-party scripts inject globals into the window. TypeScript doesn't know about them.
61
+
62
+ ### Common Globals in E-commerce
63
+
64
+ ```typescript
65
+ // types/global.d.ts
66
+
67
+ // Marketing/Recommendation platform queue pattern
68
+ export type AnalyticsCommand =
69
+ | ["cart", CartItem[]]
70
+ | ["setEmail", string]
71
+ | ["searchTerm", string]
72
+ | ["go"]
73
+ | ["view", string]
74
+ | ["category", string]
75
+ | ["recommend", RecommendOptions];
76
+
77
+ // Tag manager
78
+ // deno-lint-ignore no-var
79
+ declare global {
80
+ var dataLayer: unknown[];
81
+ }
82
+
83
+ // Third-party tracker pattern
84
+ export type TrackerFn = {
85
+ (args: unknown): void;
86
+ q?: unknown[]; // Queue for calls before script loads
87
+ aid?: string; // Account/API identifier
88
+ };
89
+
90
+ declare global {
91
+ // deno-lint-ignore no-var
92
+ var tracker: TrackerFn;
93
+ // deno-lint-ignore no-var
94
+ var AnalyticsQueue: AnalyticsCommand[];
95
+ }
96
+
97
+ // Export empty to make it a module
98
+ export {};
99
+ ```
100
+
101
+ ### Usage After Declaration
102
+
103
+ ```typescript
104
+ // Now TypeScript knows about these globals
105
+ AnalyticsQueue.push(["view", productId]);
106
+ dataLayer.push({ event: "pageview" });
107
+ ```
108
+
109
+ ---
110
+
111
+ ## 3. VTEX GraphQL Type Mismatches
112
+
113
+ VTEX SDK types often don't match the actual GraphQL response. Create bridge types.
114
+
115
+ ### Problem
116
+
117
+ ```typescript
118
+ // SDK says order has this shape:
119
+ interface Order {
120
+ items: OrderItem[];
121
+ shippingData: ShippingData;
122
+ }
123
+
124
+ // But GraphQL returns different fields:
125
+ {
126
+ items: [...],
127
+ logistics: [...], // Not shippingData!
128
+ }
129
+ ```
130
+
131
+ ### Solution: Custom Response Types
132
+
133
+ ```typescript
134
+ // types/vtex-orders.ts
135
+
136
+ // Match what GraphQL actually returns
137
+ export interface LogisticsInfo {
138
+ deliveryChannel?: string;
139
+ shippingEstimateDate?: string;
140
+ }
141
+
142
+ export interface VtexOrderData {
143
+ orderId: string;
144
+ items: OrderItem[];
145
+ logistics: LogisticsInfo[]; // Different from SDK type
146
+ totals: Total[];
147
+ }
148
+
149
+ // Usage with type assertion
150
+ const orderData = await fetchOrder(orderId);
151
+ const order = orderData as unknown as VtexOrderData;
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 4. Optional Chaining Patterns
157
+
158
+ ### Array Access
159
+
160
+ ```typescript
161
+ // BEFORE - may throw if products is undefined
162
+ const firstProduct = products[0];
163
+
164
+ // AFTER
165
+ const firstProduct = products?.[0];
166
+ ```
167
+
168
+ ### Nested Optional Access
169
+
170
+ ```typescript
171
+ // BEFORE
172
+ const city = order.shippingData.address.city;
173
+
174
+ // AFTER
175
+ const city = order?.shippingData?.address?.city ?? "Unknown";
176
+ ```
177
+
178
+ ### Method Calls on Optional
179
+
180
+ ```typescript
181
+ // BEFORE
182
+ const upper = user.getName().toUpperCase();
183
+
184
+ // AFTER
185
+ const upper = user?.getName?.()?.toUpperCase?.() ?? "";
186
+ ```
187
+
188
+ ### With Fallbacks for Different Types
189
+
190
+ ```typescript
191
+ // For strings
192
+ const title = product?.name ?? "Untitled";
193
+
194
+ // For numbers
195
+ const price = product?.price ?? 0;
196
+
197
+ // For arrays
198
+ const tags = product?.tags ?? [];
199
+
200
+ // For objects
201
+ const specs = product?.specifications ?? {};
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 5. Event Handler Types
207
+
208
+ ### Mouse Events
209
+
210
+ ```typescript
211
+ // BEFORE - implicit any
212
+ const handleClick = (e) => { ... };
213
+
214
+ // AFTER
215
+ const handleClick = (e: MouseEvent) => { ... };
216
+
217
+ // For React/Preact
218
+ const handleClick = (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => { ... };
219
+ ```
220
+
221
+ ### Input Events
222
+
223
+ ```typescript
224
+ // Generic input
225
+ const handleInput = (e: Event) => {
226
+ const target = e.target as HTMLInputElement;
227
+ const value = target.value;
228
+ };
229
+
230
+ // Preact specific
231
+ const handleInput = (e: h.JSX.TargetedEvent<HTMLInputElement>) => {
232
+ const value = e.currentTarget.value;
233
+ };
234
+ ```
235
+
236
+ ### Form Events
237
+
238
+ ```typescript
239
+ const handleSubmit = (e: h.JSX.TargetedEvent<HTMLFormElement>) => {
240
+ e.preventDefault();
241
+ // ...
242
+ };
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 6. Import Path Updates After Migration
248
+
249
+ When migrating from a fork to official apps:
250
+
251
+ ### Common Changes
252
+
253
+ ```typescript
254
+ // BEFORE - forked apps
255
+ import { ProductDetailsPage } from "apps/commerce/types.ts";
256
+ import type { Product } from "apps/commerce/types.ts";
257
+
258
+ // AFTER - may need different paths or types
259
+ import { ProductDetailsPage } from "apps/commerce/types.ts";
260
+ import type { Product } from "apps/commerce/types.ts";
261
+ // Often the same, but verify the types match
262
+ ```
263
+
264
+ ### Loader Props Pattern
265
+
266
+ ```typescript
267
+ // Ensure loaders export Props for deco
268
+ import type { Props as VTEXProps } from "apps/vtex/loaders/intelligentSearch/productList.ts";
269
+
270
+ export interface Props extends VTEXProps {
271
+ // Additional custom props
272
+ customField?: string;
273
+ }
274
+ ```
275
+
276
+ ---
277
+
278
+ ## 7. Discriminated Unions for Platform Code
279
+
280
+ If supporting multiple platforms, use discriminated unions:
281
+
282
+ ```typescript
283
+ type CartProps =
284
+ | { platform: "vtex"; cartId: string }
285
+ | { platform: "shopify"; checkoutId: string }
286
+ | { platform: "wake"; cartToken: string };
287
+
288
+ function getCart(props: CartProps) {
289
+ switch (props.platform) {
290
+ case "vtex":
291
+ return vtexCart(props.cartId);
292
+ case "shopify":
293
+ return shopifyCart(props.checkoutId);
294
+ case "wake":
295
+ return wakeCart(props.cartToken);
296
+ }
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ## 8. Type Narrowing Patterns
303
+
304
+ ### Using Type Guards
305
+
306
+ ```typescript
307
+ function isProduct(item: unknown): item is Product {
308
+ return (
309
+ typeof item === "object" &&
310
+ item !== null &&
311
+ "productID" in item &&
312
+ "name" in item
313
+ );
314
+ }
315
+
316
+ // Usage
317
+ if (isProduct(data)) {
318
+ console.log(data.name); // TypeScript knows it's a Product
319
+ }
320
+ ```
321
+
322
+ ### Assertion Functions
323
+
324
+ ```typescript
325
+ function assertProduct(item: unknown): asserts item is Product {
326
+ if (!isProduct(item)) {
327
+ throw new Error("Expected Product");
328
+ }
329
+ }
330
+ ```
@@ -0,0 +1,148 @@
1
+ # Incremental TypeScript Fixing Strategy
2
+
3
+ ## The Core Problem
4
+
5
+ Running `deno check` on a large deco storefront can take 30-60+ seconds. With 200+ errors, a naive fix-one-check-repeat loop would take hours.
6
+
7
+ ## Solution: Fast Feedback with `--unstable-tsgo`
8
+
9
+ Deno 2.1+ includes an experimental fast type checker based on the TSGo port:
10
+
11
+ ```bash
12
+ # FAST - TSGo checker (~3-5s per run) - ALWAYS use this
13
+ deno check --unstable-tsgo --allow-import main.ts
14
+ ```
15
+
16
+ **Requirements**: Deno 2.1 or later (ideally 2.6+)
17
+
18
+ > **Note for Deno 2.0+**: Always include `--allow-import` flag as it's required for remote imports.
19
+
20
+ ```bash
21
+ # Check your version
22
+ deno --version
23
+
24
+ # Update if needed
25
+ deno upgrade
26
+ ```
27
+
28
+ ## The Iterative Strategy
29
+
30
+ ### Phase 1: Assessment
31
+
32
+ ```bash
33
+ # Get total error count
34
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "ERROR"
35
+
36
+ # Save full error list
37
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 > /tmp/type-errors.txt
38
+
39
+ # Categorize errors
40
+ grep "possibly 'undefined'" /tmp/type-errors.txt | wc -l
41
+ grep "Cannot find name" /tmp/type-errors.txt | wc -l
42
+ grep "not assignable" /tmp/type-errors.txt | wc -l
43
+ grep "Property .* does not exist" /tmp/type-errors.txt | wc -l
44
+ ```
45
+
46
+ ### Phase 2: Batch Fixes
47
+
48
+ Fix errors in batches of 5-20, grouped by category:
49
+
50
+ 1. **First batch**: Missing global types (biggest impact, unlocks other fixes)
51
+ 2. **Second batch**: Props exports (straightforward, mechanical)
52
+ 3. **Third batch**: Possibly undefined errors (repetitive pattern)
53
+ 4. **Fourth batch**: Type mismatches (may need custom types)
54
+ 5. **Final batch**: Edge cases and complex fixes
55
+
56
+ ### Phase 3: Incremental Verification
57
+
58
+ After each batch:
59
+
60
+ ```bash
61
+ # Quick check - should see error count decreasing
62
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
63
+
64
+ # Commit progress
65
+ git add -A
66
+ git commit -m "fix(types): reduce deno check errors from X to Y"
67
+ ```
68
+
69
+ ### Commit Message Pattern
70
+
71
+ Use consistent commit messages to track progress:
72
+
73
+ ```
74
+ fix(types): reduce deno check errors from 200 to 180
75
+ fix(types): reduce deno check errors from 180 to 150
76
+ fix(types): reduce deno check errors from 150 to 100
77
+ ...
78
+ fix(types): achieve zero deno check TypeScript errors
79
+ ```
80
+
81
+ ## Useful Commands Cheatsheet
82
+
83
+ ```bash
84
+ # Fast type check
85
+ deno check --unstable-tsgo --allow-import main.ts
86
+
87
+ # Count errors
88
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
89
+
90
+ # Find errors in specific file
91
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep "MyComponent.tsx"
92
+
93
+ # Find specific error patterns
94
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep "TS2532" # possibly undefined
95
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep "TS2304" # cannot find name
96
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep "TS2339" # property does not exist
97
+
98
+ # List files with most errors
99
+ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep "error:" | \
100
+ sed 's/:.*//g' | sort | uniq -c | sort -rn | head -20
101
+ ```
102
+
103
+ ## Common Gotchas
104
+
105
+ ### Large Codebases May Need More Memory
106
+
107
+ ```bash
108
+ # If you hit memory issues
109
+ DENO_V8_FLAGS="--max-old-space-size=8192" deno check --unstable-tsgo --allow-import main.ts
110
+ ```
111
+
112
+ ### Some Errors Cascade
113
+
114
+ Fixing one error may reveal or fix others. If error count changes unexpectedly, re-run and re-categorize.
115
+
116
+ ## Example Session
117
+
118
+ ```bash
119
+ $ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
120
+ 215
121
+
122
+ # Fix global types
123
+ $ vim types/global.d.ts
124
+ $ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
125
+ 181
126
+ $ git add -A && git commit -m "fix(types): reduce deno check errors from 215 to 181"
127
+
128
+ # Fix Props exports
129
+ $ # ... edit multiple files ...
130
+ $ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
131
+ 150
132
+ $ git add -A && git commit -m "fix(types): reduce deno check errors from 181 to 150"
133
+
134
+ # Continue until...
135
+ $ deno check --unstable-tsgo --allow-import main.ts 2>&1 | grep -c "error:"
136
+ 0
137
+
138
+ # Done!
139
+ ```
140
+
141
+ ## Time Estimates
142
+
143
+ | Errors | With --unstable-tsgo | Without |
144
+ |--------|---------------------|---------|
145
+ | 200 errors, 10 fix cycles | ~30-50 min | ~5-10 hours |
146
+ | 50 errors, 5 fix cycles | ~15-25 min | ~2-3 hours |
147
+
148
+ The fast checker makes this process actually feasible for large codebases.