Skip to content

ember-cli-update to 6.11#2532

Open
RobbieTheWagner wants to merge 3 commits intomainfrom
latest-blueprints
Open

ember-cli-update to 6.11#2532
RobbieTheWagner wants to merge 3 commits intomainfrom
latest-blueprints

Conversation

@RobbieTheWagner
Copy link
Member

@RobbieTheWagner RobbieTheWagner commented Feb 27, 2026

Summary by CodeRabbit

  • Chores

    • Modernized config files to ES module style and updated development tooling and build configs.
    • Migrated TypeScript tooling toward Ember TS/ember-tsc and updated linting configuration.
    • Updated package scripts and dependency alignments for template compilation and tooling.
    • Adjusted .gitignore to allow tracking compiled declarations.
  • Style / Docs

    • Minor header/comment URL updates in editorconfig and robots.txt.
  • Types

    • Various typing improvements and lint directives; one new color-match type added.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

Migrate configuration files from CommonJS to ES modules, update ESLint and Babel configs, switch Type tooling from Glint to ember-tsc, adjust dependencies and scripts, modify .gitignore, bump an Ember blueprint version, and add/modify several TypeScript declaration typings and ESLint directives.

Changes

Cohort / File(s) Summary
Module System & Build Configs
babel.config.mjs, .stylelintrc.mjs
Converted configs from CommonJS to ES module syntax (module.exportsexport default); added/imported Node path helpers and @embroider/compat exports in babel.config.mjs; switched runtime resolution to import.meta.resolve.
ESLint config rewrite
eslint.config.mjs
Refactored to use defineConfig([...]) and globalIgnores(...), switched parser to @babel/eslint-parser/experimental-worker, moved ignore patterns to globalIgnores, and added per-file globals for TS files.
Dependency & Tooling changes
package.json
Replaced Glint-based type/lint tooling with ember-tsc and updated @glint packages; changed lint:types script; removed/updated several dependencies (e.g., removed tracked-built-ins, ember-auto-import, bumped template compilation plugin).
TypeScript config
tsconfig.json
Removed glint environment settings and reordered types to include @glint/ember-tsc/types before ember-source/types.
.gitignore & simple docs
.gitignore, .editorconfig, public/robots.txt
Removed declarations/ from ignore patterns; normalized header URLs to https:// in editorconfig and robots.txt comments.
Ember CLI update
config/ember-cli-update.json
Bumped @ember/app-blueprint version from 6.8.3 to 6.11.0.
Type definitions — signatures & lint directives
types/nearest-color/index.d.ts, types/ember-local-storage/index.d.ts, types/ember-cognito/test-support/index.d.ts
Added ColorMatch interface and tightened availableColors to Record<string,string> in nearest-color; changed several parameter types from {} to object (or vice versa) affecting typings; updated function parameter names where shown.
Type definitions — lint-only edits
types/global.d.ts, types/throttle-debounce/index.d.ts, types/ember-animated/motions/move.d.ts, types/ember-set-body-class/helpers/set-body-class.d.ts, types/ember-event-helpers/helpers/stop-propagation.d.ts
Inserted ESLint disable/ignore comments and minor comment additions; no runtime API changes.
Removed global augmentation
types/swach/index.d.ts
Deleted global augmentation of Array<T> with Ember.ArrayPrototypeExtensions, removed Ember import and empty export.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰
Hopping through configs with a curious glance,
CommonJS bows out as ES modules dance.
Types tuned and lint silenced, dependencies pruned,
Build scripts adjusted — the rabbit hummed a tune.
Fresh blueprints in tow, onward we prance!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change in the PR: updating ember-cli to version 6.11, which is the primary modification shown in the config/ember-cli-update.json file and the related dependency updates throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch latest-blueprints

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
types/throttle-debounce/index.d.ts (1)

1-8: Consider using a more specific function type.

The Function type is overly permissive. A more type-safe alternative would be (...args: unknown[]) => unknown or even a generic signature. However, this is acceptable for a third-party library shim.

♻️ Optional: More specific callback type
-/* eslint-disable `@typescript-eslint/no-unsafe-function-type` */
 declare module 'throttle-debounce' {
+  type AnyFunction = (...args: unknown[]) => unknown;
+
   export function debounce(
     delay: number,
     atBegin?: boolean,
-    callback?: Function
+    callback?: AnyFunction
   );
-  export function debounce(delay: number, callback?: Function);
+  export function debounce(delay: number, callback?: AnyFunction);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@types/throttle-debounce/index.d.ts` around lines 1 - 8, Replace the
overly-broad Function type in the throttle-debounce declaration with a more
specific callback signature: change the callback parameter types in both
overloaded declarations of debounce (the exported function debounce) from
Function to a typed function such as (...args: unknown[]) => unknown or a
generic like <T extends any[]>(...args: T) => unknown; update both overloads
(debounce(delay: number, atBegin?: boolean, callback?: Function) and
debounce(delay: number, callback?: Function)) to use the chosen specific
signature so callers get better type safety.
package.json (1)

121-123: Inconsistent version constraint on @glint/template.

Line 122 uses a tilde (~1.7.4) constraint while the other @glint/* packages use caret (^). This restricts @glint/template to only patch updates. If this is intentional (e.g., to avoid a known issue in newer minor versions), consider adding a comment explaining why. Otherwise, align with the caret constraint for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 121 - 123, The package constraint for
`@glint/template` is inconsistent (uses "~1.7.4") compared to the other `@glint`
packages (`@glint/ember-tsc` and `@glint/tsserver-plugin` which use "^"); either
change the `@glint/template` version constraint to "^1.7.4" to match the caret
semantics used by the other `@glint` packages, or if the tilde is deliberate, add
an inline comment in package.json explaining the reason for pinning to
patch-only versions to avoid future confusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@types/nearest-color/index.d.ts`:
- Around line 2-4: Add a proper exported ColorMatch type and tighten the
availableColors parameter: declare and export an interface ColorMatch with
properties name: string, value: string, rgb: [number, number, number], and
distance: number, change the from function signature to accept availableColors:
Array<string> | Record<string, string> (instead of object), and keep the return
type (string) => ColorMatch | string so TypeScript recognizes the returned match
shape for the exported from function.

---

Nitpick comments:
In `@package.json`:
- Around line 121-123: The package constraint for `@glint/template` is
inconsistent (uses "~1.7.4") compared to the other `@glint` packages
(`@glint/ember-tsc` and `@glint/tsserver-plugin` which use "^"); either change the
`@glint/template` version constraint to "^1.7.4" to match the caret semantics used
by the other `@glint` packages, or if the tilde is deliberate, add an inline
comment in package.json explaining the reason for pinning to patch-only versions
to avoid future confusion.

In `@types/throttle-debounce/index.d.ts`:
- Around line 1-8: Replace the overly-broad Function type in the
throttle-debounce declaration with a more specific callback signature: change
the callback parameter types in both overloaded declarations of debounce (the
exported function debounce) from Function to a typed function such as (...args:
unknown[]) => unknown or a generic like <T extends any[]>(...args: T) =>
unknown; update both overloads (debounce(delay: number, atBegin?: boolean,
callback?: Function) and debounce(delay: number, callback?: Function)) to use
the chosen specific signature so callers get better type safety.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e02162 and bbac281.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • .editorconfig
  • .gitignore
  • .stylelintrc.mjs
  • app/services/.gitkeep
  • babel.config.mjs
  • config/ember-cli-update.json
  • eslint.config.mjs
  • package.json
  • public/robots.txt
  • tsconfig.json
  • types/ember-animated/motions/move.d.ts
  • types/ember-set-body-class/helpers/set-body-class.d.ts
  • types/global.d.ts
  • types/nearest-color/index.d.ts
  • types/throttle-debounce/index.d.ts
💤 Files with no reviewable changes (1)
  • .gitignore

Comment on lines 2 to 4
export function from(
availableColors: Array<string> | Object
availableColors: Array<string> | object
): (string) => ColorMatch | string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether ColorMatch is declared anywhere else in repo
rg -n --type=ts '\binterface\s+ColorMatch\b|\btype\s+ColorMatch\b|declare module .nearest-color.'

# Inspect current declaration file in full
fd 'index.d.ts' types | xargs -I{} sh -c 'echo "---- {} ----"; cat -n "{}"'

Repository: shipshapecode/swach

Length of output: 3186


🏁 Script executed:

# Find package.json to check nearest-color version
fd 'package.json' | head -5 | xargs grep -l 'nearest-color' 2>/dev/null || echo "Not found in package.json"

# Also check if there's a types/ directory README or any docs
fd 'README|readme' types/nearest-color/ 2>/dev/null || echo "No readme in types/nearest-color"

Repository: shipshapecode/swach

Length of output: 75


🏁 Script executed:

# Extract nearest-color dependency info from package.json
rg '"nearest-color"' -A 2 -B 2 package.json

Repository: shipshapecode/swach

Length of output: 219


🌐 Web query:

nearest-color npm package documentation types ColorMatch 0.4.4

💡 Result:

nearest-color@0.4.4 (the actual library) does not ship TypeScript declarations, so you won’t find a ColorMatch type in its own docs/package. (npmjs.com)

For TypeScript, the ColorMatch type comes from DefinitelyTyped via @types/nearest-color (published as 0.4.1, intended for the nearest-color package). (npmjs.com)

Where to see the ColorMatch type definition

  • After installing, open: node_modules/@types/nearest-color/index.d.ts (npmjs.com)
  • Install: npm i -D @types/nearest-color`` (npmjs.com)

Citations:


🏁 Script executed:

# Check if `@types/nearest-color` is listed in package.json
rg '@types/nearest-color' package.json

# Check the actual types definition from the official `@types` package
# First, let's see if node_modules exists and what's available
fd '@types.*nearest-color' node_modules 2>/dev/null || echo "Not installed or node_modules not available"

# Also check the devDependencies section
rg -A 20 '"devDependencies"' package.json | head -30

Repository: shipshapecode/swach

Length of output: 923


🏁 Script executed:

# Continue looking through devDependencies for `@types` packages
rg -A 100 '"devDependencies"' package.json | grep '@types' | head -20

Repository: shipshapecode/swach

Length of output: 236


🌐 Web query:

@types/nearest-color index.d.ts ColorMatch definition github

💡 Result:

Web search failed: Server error: no LLM provider could handle the message


🏁 Script executed:

# Let's check the DefinitelyTyped repo directly via common paths
# or look for any documentation about what ColorMatch should be

# First, check if there are any comments or references to ColorMatch elsewhere
rg 'ColorMatch' --type ts --type js -B 2 -A 2

# Also check if there's a tsconfig or similar that might configure type roots
fd 'tsconfig' | head -5 | xargs cat 2>/dev/null || echo "No tsconfig found"

Repository: shipshapecode/swach

Length of output: 1692


🏁 Script executed:

# Let's look for what the actual `@types/nearest-color` would define
# by checking if we can find any usage patterns or if there's a copy somewhere

# Search for any nearest-color related code that might hint at the structure
rg 'nearest-color|ColorMatch' --type ts --type js -B 3 -A 3 | head -50

Repository: shipshapecode/swach

Length of output: 1774


🏁 Script executed:

# Look at the actual usage in nearest-color.ts service to understand the return type structure
cat -n app/services/nearest-color.ts

# Also check the color-picker.ts to see how the result is used
sed -n '1,50p' electron-app/src/color-picker.ts | cat -n

Repository: shipshapecode/swach

Length of output: 2569


🏁 Script executed:

# Let's check if there are any lint/TypeScript errors in the build
fd 'tsconfig' -type f | xargs grep -l 'nearest-color' 2>/dev/null

# Check if there are any test files that might show the expected type
fd 'test.*nearest-color|nearest-color.*test' --type f

Repository: shipshapecode/swach

Length of output: 233


🏁 Script executed:

# Check the actual return type structure used in the codebase
rg 'ColorMatch|getColorName.*=>|nearest\(' app/ electron-app/ --type ts -A 3 -B 1 | head -60

Repository: shipshapecode/swach

Length of output: 364


🏁 Script executed:

# Check the actual DefinitelyTyped definition by looking at TS error or checking if types should come from `@types`
# Let's see what the proper approach is - either install `@types` or define it locally

# Search for how other local type definitions are structured
find types -name '*.d.ts' -exec grep -l 'interface\|type' {} \; | head -3 | xargs cat

# Also check if the repo ever had `@types/nearest-color` or references to it
git log --all --oneline -- package.json 2>/dev/null | head -5 || echo "Git history not available"

Repository: shipshapecode/swach

Length of output: 2543


🏁 Script executed:

# Let's check the `@types/nearest-color` to see the actual standard definition
# by looking up the DefinitelyTyped repository definition online or checking what nearest-color actually returns

# First, let's verify what the actual expected structure is based on usage
rg 'nearestColor|\.name|\.value|\.rgb|\.distance' app/ electron-app/ -B 2 -A 2 | head -60

Repository: shipshapecode/swach

Length of output: 3047


Define ColorMatch with all required properties; current declaration is incomplete and fails type checking.

Line 4 references an undeclared ColorMatch type, causing TypeScript errors. The actual nearest-color library returns an object with name, value, rgb, and distance properties. Also, line 3 can be tightened from object to Record<string, string> for safety.

✅ Suggested fix
 declare module 'nearest-color' {
+  export interface ColorMatch {
+    name: string;
+    value: string;
+    rgb: { r: number; g: number; b: number };
+    distance: number;
+  }
+
   export function from(
-    availableColors: Array<string> | object
-  ): (string) => ColorMatch | string;
+    availableColors: Array<string> | Record<string, string>
+  ): (needle: string) => ColorMatch | string;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function from(
availableColors: Array<string> | Object
availableColors: Array<string> | object
): (string) => ColorMatch | string;
declare module 'nearest-color' {
export interface ColorMatch {
name: string;
value: string;
rgb: { r: number; g: number; b: number };
distance: number;
}
export function from(
availableColors: Array<string> | Record<string, string>
): (needle: string) => ColorMatch | string;
}
🧰 Tools
🪛 GitHub Actions: Linting

[error] 4-4: 'ColorMatch' is an 'error' type that acts as 'any' and overrides all other types in this union type (no-redundant-type-constituents)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@types/nearest-color/index.d.ts` around lines 2 - 4, Add a proper exported
ColorMatch type and tighten the availableColors parameter: declare and export an
interface ColorMatch with properties name: string, value: string, rgb: [number,
number, number], and distance: number, change the from function signature to
accept availableColors: Array<string> | Record<string, string> (instead of
object), and keep the return type (string) => ColorMatch | string so TypeScript
recognizes the returned match shape for the exported from function.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
types/nearest-color/index.d.ts (1)

2-11: LGTM! The ColorMatch interface and improved type safety address the previous review concerns.

The interface correctly defines all properties (name, value, rgb, distance) matching the library's actual return structure, and Record<string, string> is appropriately more specific than object.

Optional: Consider adding export to the interface so consumers can directly import ColorMatch for explicit type annotations:

-  interface ColorMatch {
+  export interface ColorMatch {

Without the export, the type is still correctly inferred when using the from() function, so this is a nice-to-have rather than a requirement.

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@types/nearest-color/index.d.ts` around lines 2 - 11, Add an export to the
ColorMatch interface so consumers can import the type directly: update the
declaration of ColorMatch to be exported (export interface ColorMatch) alongside
the existing exported from() function; this is a non-breaking, type-only change
that enables explicit annotations and improves DX when referencing ColorMatch in
user code or tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@types/ember-cognito/test-support/index.d.ts`:
- Line 12: Change the ambient declaration for mockCognitoUser by removing the
default parameter initializer; replace `options: object = {}` with an optional
parameter `options?: object` in the declaration of the function
`mockCognitoUser` so the `.d.ts` file does not contain a parameter default value
and still conveys that the argument is optional and returns `MockUser`.

In `@types/ember-local-storage/index.d.ts`:
- Line 5: The ambient declaration uses an invalid default parameter initializer
`options: object = {}`; replace it with optional parameter syntax (e.g.,
`options?: object`) in the declaration so the `.d.ts` file compiles—locate the
function/constructor declaration that contains the `options` parameter and
change its signature from using `= {}` to `?` (reference the `options` parameter
in the types/ember-local-storage index.d.ts diff).

---

Nitpick comments:
In `@types/nearest-color/index.d.ts`:
- Around line 2-11: Add an export to the ColorMatch interface so consumers can
import the type directly: update the declaration of ColorMatch to be exported
(export interface ColorMatch) alongside the existing exported from() function;
this is a non-breaking, type-only change that enables explicit annotations and
improves DX when referencing ColorMatch in user code or tests.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bbac281 and 60a5f81.

📒 Files selected for processing (5)
  • types/ember-cognito/test-support/index.d.ts
  • types/ember-event-helpers/helpers/stop-propagation.d.ts
  • types/ember-local-storage/index.d.ts
  • types/nearest-color/index.d.ts
  • types/swach/index.d.ts
💤 Files with no reviewable changes (1)
  • types/swach/index.d.ts

export const MockUser = EmberObject.extend({ create() {} });
export const mockAuth = any;
export declare function mockCognitoUser(options: {} = {}): MockUser;
export declare function mockCognitoUser(options: object = {}): MockUser;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's check the specific file mentioned
cd . && ls -la types/ember-cognito/test-support/index.d.ts 2>/dev/null && cat -n types/ember-cognito/test-support/index.d.ts

Repository: shipshapecode/swach

Length of output: 820


🏁 Script executed:

# Also run the verification script to check for similar issues
rg -nP --glob '*.d.ts' '\b(?:export\s+)?(?:declare\s+)?function\b[^\n]*\([^)]*=\s*[^)]*\)'

Repository: shipshapecode/swach

Length of output: 184


🌐 Web query:

TypeScript declaration files .d.ts default parameter initializer best practices

💡 Result:

Key rule: you can’t encode runtime default values in .d.ts

In a declaration file, parameter initializers are not allowed (because there’s no implementation), so alpha = 1.0 is a syntax error in .d.ts. Use types + docs instead. [1], [5], [10]

Recommended patterns

1) Model “has a default” as an optional parameter

// implementation: function axpy(x, y, alpha = 1.0) { ... }
export function axpy(x: Float32Array, y: Float32Array, alpha?: number): void;

This matches how TypeScript models “argument may be omitted”. [7]

2) If there are multiple optional knobs, prefer an options bag

export interface AxpyOptions {
  alpha?: number; // default: 1.0
}

export function axpy(x: Float32Array, y: Float32Array, options?: AxpyOptions): void;

This keeps call sites readable as options grow (and avoids long ordered optional params). [1]

3) Document the default value (since the type system won’t)

Use JSDoc (works well in editors/tooling):

/** `@param` alpha Default is 1.0 */
export function axpy(x: Float32Array, y: Float32Array, alpha?: number): void;

The need for documentation here is exactly because .d.ts files are type-only. [10]

4) Avoid overload explosions; use optional params where possible

Prefer alpha?: number (or an options bag) over many overloads that only differ by presence/absence of trailing args. [2]

5) Don’t try to “fake” defaults with types

Avoid patterns like alpha: number | undefined unless you specifically need to allow explicit undefined in a non-optional position; in most APIs, alpha?: number is the cleanest declaration for a defaulted parameter. (TypeScript treats omitted args as undefined at runtime anyway.) [7]


Sources

[1] Google TypeScript Style Guide – parameter initializers & guidance on using them sparingly / prefer destructuring for many optional params: https://google.github.io/styleguide/tsguide.html
[2] TypeScript Handbook (Declaration Files) – “Do’s and Don’ts” (optional params vs overloads): https://deepwiki.com/microsoft/TypeScript-Handbook/5-declaration-files
[5] Stack Overflow – “A parameter initializer is only allowed in a function or constructor implementation” in .d.ts: https://stackoverflow.com/questions/41057285/is-it-possible-to-declare-default-function-parameters-in-typescript-declaration
[7] TypeScript Handbook (New Handbook) – optional parameters & default parameters behavior: https://microsoft.github.io/TypeScript-New-Handbook/everything/
[10] TypeScript Handbook – .d.ts files are type-only and don’t emit JS: https://www.typescriptlang.org/docs/handbook/2/type-declarations


Remove default parameter initializer from ambient declaration.

On Line 12, options: object = {} violates TypeScript declaration file rules. Parameter initializers are not allowed in .d.ts files; use an optional parameter instead.

Proposed fix
-  export declare function mockCognitoUser(options: object = {}): MockUser;
+  export declare function mockCognitoUser(options?: object): MockUser;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export declare function mockCognitoUser(options: object = {}): MockUser;
export declare function mockCognitoUser(options?: object): MockUser;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@types/ember-cognito/test-support/index.d.ts` at line 12, Change the ambient
declaration for mockCognitoUser by removing the default parameter initializer;
replace `options: object = {}` with an optional parameter `options?: object` in
the declaration of the function `mockCognitoUser` so the `.d.ts` file does not
contain a parameter default value and still conveys that the argument is
optional and returns `MockUser`.

key: string,
modelName?: string,
options: {} = {}
options: object = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find and examine the specific file
find . -name "index.d.ts" -path "*/ember-local-storage/*" -type f

Repository: shipshapecode/swach

Length of output: 101


🏁 Script executed:

# Run the verification script from the review comment
rg -nP --glob '*.d.ts' '\b(?:export\s+)?(?:declare\s+)?function\b[^\n]*\([^)]*=\s*[^)]*\)' | head -20

Repository: shipshapecode/swach

Length of output: 184


🏁 Script executed:

# Also let's search more broadly for declare functions with initializers
rg -n 'declare function' --glob '*.d.ts' -A 2 | head -50

Repository: shipshapecode/swach

Length of output: 1400


🏁 Script executed:

# Let's read the actual ember-local-storage declaration file
cat -n types/ember-local-storage/index.d.ts

Repository: shipshapecode/swach

Length of output: 261


🏁 Script executed:

# Let's also check if TypeScript actually allows default parameters in declare functions
# by looking at the tsconfig and any compilation settings
find . -name "tsconfig.json" -o -name "tsconfig.*.json" | head -5

Repository: shipshapecode/swach

Length of output: 387


🏁 Script executed:

# Let's check the tsconfig to see if there are any settings that might affect this
cat tsconfig.json

Repository: shipshapecode/swach

Length of output: 586


🏁 Script executed:

# Let's verify if TypeScript would actually flag this as an error
# by looking for any compilation errors or test output
find . -type f -name "*.json" -path "*/node_modules/.bin" -prune -o -type f -name "*.log" -print | grep -i "error\|test" | head -10

Repository: shipshapecode/swach

Length of output: 45


🌐 Web query:

TypeScript declaration file default parameters ambient function declare syntax rules

💡 Result:

In TypeScript declaration files (.d.ts), you generally cannot write runtime default parameter initializers (e.g. alpha = 1.0) because declarations describe types only and have no function body/implementation.

1) Ambient/overload signatures: no = value

In a .d.ts, this is not allowed:

declare function axpy(x: Float32Array, y: Float32Array, alpha = 1.0): void;
//            ❌ parameter initializer only allowed in an implementation

Ambient function declarations do not permit default parameter values; use optional parameters (?) instead. [1]

2) What to do instead: mark the parameter optional (and/or overload)

Option A — optional parameter

declare function axpy(
  x: Float32Array,
  y: Float32Array,
  alpha?: number
): void;

Option B — overloads (most explicit call shapes)

declare function axpy(x: Float32Array, y: Float32Array): void;
declare function axpy(x: Float32Array, y: Float32Array, alpha: number): void;

Also note: overload signatures cannot specify default values either—only optional (?) is allowed. [1]

3) If you want to communicate the default value

TypeScript has no standard type-level way to encode “defaults to 1.0” in a .d.ts. Common practice is to document it with comments/JSDoc (for editor hints), while keeping the type as optional. (This limitation is the same issue described in the VS Code error you saw.) [2]

4) What is allowed in .d.ts: default generic type parameters

Don’t confuse value defaults with generic type parameter defaults—those are allowed in declarations:

declare function create<T = HTMLDivElement>(element?: T): T;

[3]

Sources: ambient declarations / no default parameter values [1], .d.ts default parameter question + error context [2], generic type parameter defaults in declarations [3].

[1] https://gist.github.com/robertknight/9ec6ea9f32d2c120cb1c
[2] https://stackoverflow.com/questions/41057285/is-it-possible-to-declare-default-function-parameters-in-typescript-declaration
[3] https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html


🏁 Script executed:

# Let's check if there are TypeScript compilation errors in the project
# Look for any .tsbuildinfo or compilation output
find . -name "*.tsbuildinfo" -o -name "dist" -type d | head -5

Repository: shipshapecode/swach

Length of output: 479


🏁 Script executed:

# Let's specifically look at the ember-cognito file which also has the same issue
cat -n types/ember-cognito/test-support/index.d.ts

Repository: shipshapecode/swach

Length of output: 728


🏁 Script executed:

# Check if there's any build or test output that shows TypeScript errors
ls -la | grep -i "build\|dist\|error"

Repository: shipshapecode/swach

Length of output: 133


Use optional parameter syntax in declaration files.

On Line 5, the parameter syntax options: object = {} is invalid in ambient function declarations. TypeScript does not allow default parameter initializers in .d.ts files; use optional parameter syntax instead.

Proposed fix
-    options: object = {}
+    options?: object
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
options: object = {}
options?: object
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@types/ember-local-storage/index.d.ts` at line 5, The ambient declaration uses
an invalid default parameter initializer `options: object = {}`; replace it with
optional parameter syntax (e.g., `options?: object`) in the declaration so the
`.d.ts` file compiles—locate the function/constructor declaration that contains
the `options` parameter and change its signature from using `= {}` to `?`
(reference the `options` parameter in the types/ember-local-storage index.d.ts
diff).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant