Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const locations: Locations = {
LOCATION_ENTRY_FIELD: 'entry-field',
LOCATION_ENTRY_FIELD_SIDEBAR: 'entry-field-sidebar',
LOCATION_ENTRY_SIDEBAR: 'entry-sidebar',
LOCATION_ASSET_SIDEBAR: 'asset-sidebar',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

New location key added — looks good.

Addition aligns with existing naming and mapping conventions.

Run to confirm type availability and barrel re-exports resolve correctly, and that Location[keyof Location] includes 'asset-sidebar':


🏁 Script executed:

#!/bin/bash
# Definitions for Location/Locations
rg -nP -C2 'export\s+(?:type|interface)\s+Location\b' lib
rg -nP -C2 'export\s+(?:type|interface)\s+Locations\b' lib

# Ensure the literal is present across types and constants
rg -n -C2 "asset-sidebar" lib

Length of output: 941


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "----- search for singular 'Location' type/interface declarations -----"
rg -nP -C2 '(^|\s)export\s+(?:type|interface)\s+Location\b' || true
rg -nP -C2 '\btype\s+Location\b' || true

echo
echo "----- search for 'Locations' declarations/uses -----"
rg -nP -n -C2 '\bLocations\b' || true

echo
echo "----- search for 'keyof Location' / 'Location[keyof' usages -----"
rg -nP -n -C2 'keyof\s+Location' || true
rg -nP -n -C2 'Location\s*\[\s*keyof' || true

echo
echo "----- show lib/locations.ts -----"
if [ -f lib/locations.ts ]; then
  sed -n '1,240p' lib/locations.ts
else
  echo "lib/locations.ts not found"
fi

echo
echo "----- show lib/types/api.types.ts (around Locations) -----"
if [ -f lib/types/api.types.ts ]; then
  sed -n '360,420p' lib/types/api.types.ts || true
else
  echo "lib/types/api.types.ts not found"
fi

echo
echo "----- search for barrel re-exports referencing locations/types -----"
rg -nP -C2 "export .* from .*locations" || true
rg -nP -C2 "export .* from .*types" || true
rg -nP -C2 "export \* from .*locations" || true
rg -nP -C2 "export \* from .*types" || true

echo
echo "----- show lib/index.ts and lib/types/index.ts if present -----"
[ -f lib/index.ts ] && sed -n '1,240p' lib/index.ts || echo "lib/index.ts not found"
[ -f lib/types/index.ts ] && sed -n '1,240p' lib/types/index.ts || echo "lib/types/index.ts not found"

Length of output: 8244


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "----- all 'Location' word occurrences -----"
rg -nP --hidden '\bLocation\b' lib || true

echo
echo "----- explicit 'type Location' / 'interface Location' matches -----"
rg -nP '\b(type|interface)\s+Location\b' lib || true
rg -nP '\btype\s+Location\s*=' lib || true

echo
echo "----- show start of lib/types/api.types.ts (1-480) -----"
sed -n '1,480p' lib/types/api.types.ts || true

echo
echo "----- show lib/types/index.ts (1-240) -----"
sed -n '1,240p' lib/types/index.ts || true

Length of output: 16720


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "----- show lib/types/utils.ts (full) -----"
if [ -f lib/types/utils.ts ]; then
  sed -n '1,240p' lib/types/utils.ts || true
else
  echo "lib/types/utils.ts not found"
fi

echo
echo "----- search for 'type Location' or 'export type Location' -----"
rg -nP '\b(export\s+)?type\s+Location\b' || true

echo
echo "----- search for 'Location =' patterns -----"
rg -nP 'Location\s*=' || true

Length of output: 2749


Fix ConnectMessage type: Location is undefined — use Locations

Locations interface (lib/types/api.types.ts:385) and lib/locations.ts include 'asset-sidebar', but ConnectMessage uses location: Location[keyof Location] (lib/types/api.types.ts:399); there is no Location type in the repo so this resolves to the global DOM Location and does not include 'asset-sidebar'. Action: change to location: Locations[keyof Locations] or add export type Location = Locations in the types so the indexed type includes the new literal.

🤖 Prompt for AI Agents
In lib/locations.ts around line 7, the export LOCATION_ASSET_SIDEBAR adds
'asset-sidebar' to the Locations map but ConnectMessage in
lib/types/api.types.ts uses a non-existent Location type causing TypeScript to
resolve to the global DOM Location and miss this literal; fix by updating the
ConnectMessage type to reference the correct indexed type (location:
Locations[keyof Locations]) or add an export alias type (export type Location =
Locations) in the types file so the indexed type includes 'asset-sidebar' and
other literals.

LOCATION_DIALOG: 'dialog',
LOCATION_ENTRY_EDITOR: 'entry-editor',
LOCATION_PAGE: 'page',
Expand Down
1 change: 1 addition & 0 deletions lib/types/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export interface Locations {
LOCATION_ENTRY_FIELD: 'entry-field'
LOCATION_ENTRY_FIELD_SIDEBAR: 'entry-field-sidebar'
LOCATION_ENTRY_SIDEBAR: 'entry-sidebar'
LOCATION_ASSET_SIDEBAR: 'asset-sidebar'
LOCATION_DIALOG: 'dialog'
LOCATION_ENTRY_EDITOR: 'entry-editor'
LOCATION_PAGE: 'page'
Expand Down