With typescript-native-bridge@6.0.3-bridge.10.tsgo.7.0.2, two referenced projects include the same source file and declaration file. After deleting a line, retyping it one character at a time, and requesting completion after the first identifier character B, completionInfo returns an optionalReplacementSpan that crosses into the next line.
The response still contains the Buffer alias, but an editor can discard the semantic completion because the replacement range is invalid.
Reproduction
package.json:
{
"private": true,
"devDependencies": {
"@types/node": "26.1.1",
"typescript": "npm:typescript-native-bridge@6.0.3-bridge.10.tsgo.7.0.2"
}
}
tsconfig.json:
{
"references": [
{ "path": "./first/tsconfig.json" },
{ "path": "./.secondary/tsconfig.json" }
],
"files": []
}
first/tsconfig.json:
{
"compilerOptions": {
"composite": true,
"types": [
"node"
]
},
"include": [
"../repro.ts",
"../.secondary/empty.d.ts"
]
}
.secondary/tsconfig.json:
{
"compilerOptions": {
"composite": true,
"types": [
"node"
]
},
"include": [
"../repro.ts",
"./empty.d.ts"
]
}
.secondary/empty.d.ts:
repro.ts:
import { Buffer } from "node:buffer";
export function encode(value: string) {
const actual = Buffer.from(value);
return actual.toString("base64url");
}
- Run
pnpm install.
- Open the project and select the workspace TypeScript version.
- Open
repro.ts.
- Delete all of line 4, including its trailing newline. The blank line previously at line 5 should now be line 4.
- On line 4, type two spaces followed by
const actual = B, one character at a time. Do not paste the complete text.
- With the caret immediately after
B, press Ctrl+Space to invoke completion.
Expected
The result contains the Buffer alias and replaces only the newly typed B: 4:18 → 4:19.
Actual
The editor does not show the semantic Buffer completion, and B remains an unresolved identifier.
The underlying completion response contains the Buffer alias, but its optionalReplacementSpan is the cross-line range 4:18 → 5:23. TypeScript 6.0.3 returns the correct 4:18 → 4:19 range for the same edit sequence.
This issue was created with assistance from a code agent.
With
typescript-native-bridge@6.0.3-bridge.10.tsgo.7.0.2, two referenced projects include the same source file and declaration file. After deleting a line, retyping it one character at a time, and requesting completion after the first identifier characterB,completionInforeturns anoptionalReplacementSpanthat crosses into the next line.The response still contains the
Bufferalias, but an editor can discard the semantic completion because the replacement range is invalid.Reproduction
package.json:{ "private": true, "devDependencies": { "@types/node": "26.1.1", "typescript": "npm:typescript-native-bridge@6.0.3-bridge.10.tsgo.7.0.2" } }tsconfig.json:{ "references": [ { "path": "./first/tsconfig.json" }, { "path": "./.secondary/tsconfig.json" } ], "files": [] }first/tsconfig.json:{ "compilerOptions": { "composite": true, "types": [ "node" ] }, "include": [ "../repro.ts", "../.secondary/empty.d.ts" ] }.secondary/tsconfig.json:{ "compilerOptions": { "composite": true, "types": [ "node" ] }, "include": [ "../repro.ts", "./empty.d.ts" ] }.secondary/empty.d.ts:repro.ts:pnpm install.repro.ts.const actual = B, one character at a time. Do not paste the complete text.B, pressCtrl+Spaceto invoke completion.Expected
The result contains the
Bufferalias and replaces only the newly typedB:4:18 → 4:19.Actual
The editor does not show the semantic
Buffercompletion, andBremains an unresolved identifier.The underlying completion response contains the
Bufferalias, but itsoptionalReplacementSpanis the cross-line range4:18 → 5:23. TypeScript 6.0.3 returns the correct4:18 → 4:19range for the same edit sequence.This issue was created with assistance from a code agent.