TypeScript outline: locals inside an exported call are marked exported, and destructured exports have no symbol
Two symbol-extraction gaps in TS/TSX that give agents a wrong picture of a file.
1. Locals inherit E. A symbol counts as exported when its byte range lies inside any export statement (crates/aft-parse/src/parser.rs:3049-3092, collect_exports / is_exported). So every function or const declared inside an exported factory is listed as a top-level export.
export const { use: useCommand, provider: CommandProvider } = createSimpleContext({
name: "Command",
init: () => {
const bind = (id: string) => { /* … */ }
const run = (id: string) => { /* … */ }
function register(key: string) { /* … */ }
return { bind, run, register }
},
})
aft_outline lists E const bind, E const run, E function register at the top level, next to the file's real exports. The same happens for locals inside an exported function body (export function configured() { const isSessionEvent = …; function commitDurableEvent() {…} }): about 30 locals in one file showed as E.
Expected: locals are either omitted or nested under their parent, and never marked exported.
2. Destructured exports are invisible. In the snippet above, useCommand and CommandProvider don't appear in the outline at all. aft_zoom … useCommand returns symbol 'useCommand' not found, aft_callgraph callers … useCommand returns symbol_not_found, and aft_search "useCommand" ranks a mock that defines useCommand with a plain const above the real definition. In the repo where I hit this, about 40 files import that hook.
Expected: each name bound by an exported destructuring pattern is a symbol (outline, zoom, callgraph target, search definition).
Seen on v0.68.0/0.68.1.
Thanks, @null-axiom, both confirmed. The outline decides "exported" by checking whether a declaration sits inside an export statement's text, so locals inside an exported function or initializer get marked too. Destructured export const { a, b } = … bindings are skipped entirely, which is also why aft_zoom can't find them. The fix marks exports by what the export statement actually declares and adds one symbol per destructured name, so zoom can find each one. It's planned for the next release.