jsii crashes with internal Error when using `effect/schema`
Describe the bug
The following Code makes jsii crash:
import { Schema } from "effect"
export class BaseMessage extends Schema.Class<BaseMessage>("BaseMessage")({
op: Schema.String,
id: Schema.UUID,
data: Schema.Unknown
}) {}
package.json
{
"name": "ommited-data",
"version": "0.0.1",
"description": "Library to validate the Ommited Messages",
"author": {
"name": "Author",
"email": "[email protected]"
},
"repository": {
"url": "https://github.com/ommited/OMMITED-Data.git"
},
"license": "UNLICENSED",
"main": "./src/index.ts",
"scripts": {
"build": "jsii",
"build:watch": "jsii --watch",
"package": "jsii-pacmak"
},
"dependencies": {
"@effect/schema": "^0.75.5",
"effect": "^3.12.1"
},
"bundledDependencies": [
"@effect/schema",
"effect"
],
"stability": "experimental",
"types": "./dist/index.d.ts",
"jsii": {
"versionFormat": "full",
"targets": {
"dotnet": {
"namespace": "OMMITED.Data",
"packageId": "OMMITED.Data",
"versionSuffix": "-devpreview"
}
},
"outdir": "./lib",
"tsc": {
"outDir": "dist",
"rootDir": "src"
}
}
}
jsii Error:
error JSII9997: Unknown error: Cannot read properties of undefined (reading 'getJsDocTags') -- TypeError: Cannot read properties of undefined (reading 'getJsDocTags')
at _hasInternalJsDocTag (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1866:19)
at Assembler._isPrivateOrInternal (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1111:37)
at Assembler._visitClass (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:871:33)
at Assembler._visitNode (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:667:29)
at Assembler.emit (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:133:26)
at Compiler.consumeProgram (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:177:40)
at host.afterProgramCreate (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:71:37)
at synchronizeProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132797:12)
at updateProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132995:9)
at Timeout.updateProgramWithWatchStatus [as _onTimeout] (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132984:5)
This happens when running with node or bun. The above error is when running with node, despite the paths saying .bun
Running with bun produces the same error, just different wording:
error JSII9997: Unknown error: undefined is not an object (evaluating 'symbol.getJsDocTags') -- TypeError: undefined is not an object (evaluating 'symbol.getJsDocTags')
at _hasInternalJsDocTag (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1866:12)
at _isPrivateOrInternal (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:1111:37)
at _visitClass (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:871:33)
at _visitNode (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:667:29)
at emit (/home/marvin/.bun/install/global/node_modules/jsii/lib/assembler.js:133:26)
at consumeProgram (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:177:40)
at <anonymous> (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:71:37)
at synchronizeProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132797:12)
at createWatchProgram (/home/marvin/.bun/install/global/node_modules/typescript/lib/typescript.js:132701:3)
at <anonymous> (/home/marvin/.bun/install/global/node_modules/jsii/lib/compiler.js:82:26)
Regression Issue
- [ ] Select this option if this issue appears to be a regression.
Expected Behavior
jsii compiles the code or gives an error why it can not be compiled
Current Behavior
jsii encounters an internal error
Reproduction Steps
Described above
Possible Solution
Check why base.symbol is undefined in jsii/lib/assembler.js:871
Additional Information/Context
jsii --version
5.7.4 (build fc2a28e), typescript 5.7.3
SDK version used
5.7.4 (build fc2a28e), typescript 5.7.3
Environment details (OS name and version, etc.)
Pop!_OS 22.04 LTS with kernel 6.9.3-76060903-generic
This example involves interfaces with construct signatures, and a very complex hierarchy. This use case was probably not taken into account when jsii was designed, and this will require a deep dive. Marking this
Note that generics are not supported at this time, and the provided examples is not legal code in jsii. A fix will only be to replace the uncaught error with a specific failure. Not to make this code legal.