Skip to content

10.8.0 breaks Java/Go transliteration for downstream jsii-rosetta consumers #2879

Closed

Description

@jsteinich

What happened

10.8.0 changed jsii.tsc: { outDir: "lib", rootDir: "src" } to jsii.tsconfig + validateTsconfig in package.json. That drops jsii.tsc.outDir, which downstream consumers need in order to map the shipped lib/*.d.ts paths back to the src/... symbol ids recorded in the assembly.

The consequence is that any tool transliterating TypeScript that imports constructs now emits incorrect Java and Go imports:

language expected actual on 10.8.0
Java import software.constructs.Construct; import constructs.Construct;
Go "github.com/aws/constructs-go/constructs" "github.com/aws-samples/dummy/constructs"

Python and C# are unaffected, but only coincidentally — rosetta's fallback name derivation (constructs, Constructs) happens to match the correct target names for those two languages.

The failure is silent: the assembly loads fine and the lookup just degrades to "not a jsii symbol", so the output looks plausible.

Reproduction

mkdir repro && cd repro && npm init -y
npm install [email protected] [email protected]

cat > snippet.ts <<'EOF'
import { Construct } from "constructs";
export class Foo extends Construct {
  constructor(scope: Construct, id: string) { super(scope, id); }
}
EOF

cat > run.js <<'EOF'
const rosetta = require("jsii-rosetta");
const fs = require("fs"), path = require("path");
const file = {
  contents: fs.readFileSync(path.join(__dirname, "snippet.ts"), "utf8"),
  fileName: path.join(__dirname, "snippet.ts"),
};
console.log("constructs", require("constructs/package.json").version);
for (const [name, V] of [["java", rosetta.JavaVisitor], ["go", rosetta.GoVisitor]]) {
  const { translation } = rosetta.translateTypeScript(file, new V(), {});
  console.log(" ", name.padEnd(4), "->", translation.split("\n").find((l) => /constructs/i.test(l)).trim());
}
EOF

node run.js
npm install [email protected] && node run.js

10.7.2 is correct; 10.8.0 is not. Patching jsii.tsc back into the installed 10.8.0 package.json restores correct output with nothing else changed, which isolates it to this field.

Reproduced on both [email protected] and [email protected], so it is not resolved by consumers upgrading to the jsii 6.x toolchain.

Note

The underlying gap is in jsii itself: symbolIdentifier() falls back to assembly.metadata.tscRootDir when jsii.tsc.rootDir is absent, but has no equivalent fallback for outDir, and tsconfig.json is not published in the npm tarball. I have filed that separately as aws/jsii-compiler#2740.

Raising it here as well since constructs is likely the most widely consumed package to adopt jsii.tsconfig, and it may be worth restoring jsii.tsc.outDir/rootDir in a patch release until the jsii-side fix ships.

Environment

  • constructs 10.8.0 (broken) vs 10.7.2 (fine)
  • jsii-rosetta 6.0.7 / jsii 6.0.7, also 5.9.39 / 5.9.x
  • Node.js v22.22.2

Activity

  1. mrgrain commented on Aug 3, 2026

    @mrgrain
    Collaborator

    Thanks for the report! Deprecated 10.8.0 for now. Working on a compiler fix and will then release constructs with jsii.tsc.outDir.
    There's also going to be a fix in jsii-rosetta I think.

  2. added 2 commits that reference this issue on Aug 3, 2026
    b63b692
    d3249f5
  3. mrgrain commented on Aug 3, 2026

    @mrgrain
    Collaborator

    10.8.1 released and should work with existing rosetta versions. But we also have new versions of jsii-rosetta out to address the issue better. Plus jsii-complier now has the proposed fix.

  4. mrgrain commented on Aug 3, 2026

    @mrgrain
    Collaborator

    @jsteinich Let me know if this solves it for you!

  5. jsteinich commented on Aug 7, 2026

    @jsteinich
    Author

    @jsteinich Let me know if this solves it for you!

    @mrgrain Tests are working locally. Thanks.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions