-
Notifications
You must be signed in to change notification settings - Fork 44
generating interfaces instead of implenetations #462
Comments
@Coobaha interested in learning more how these look like. Would you add a couple of examples of |
how I see this mode:
I print interface files from ts code with
We have two steps build for modules that will be consumed as npm packages:
example of definitons from |
Noting down a couple of quick observations:
|
I would be interested in this too. I would ideally like to keep a {
"exports": {
".": {
"import": "./lib/es6/src/Main.mjs",
"require": "./lib/js/src/Main.js"
},
"./lib/*": "./lib/*",
"./src/*": "./src/*"
},
"main": "lib/js/src/Main.js",
"module": "lib/es6/src/Main.mjs",
"types": "types/Main.d.ts"
} ReScript can manage everything except for the |
Would TypeScript understand |
In case anyone is struggling with this, I was able to generate #!/usr/bin/env bash
bsJsPath="$1"
bsDTsPath="${bsJsPath/bs\.js/bs\.d\.ts}"
genTsxPath="${bsJsPath/bs\.js/gen\.tsx}"
genDTsPath="${bsJsPath/bs\.js/gen\.d\.ts}"
# Generate .gen.d.ts file (note: when tsc receives a path, it'll ignore tsconfig.json)
tsc --skipLibCheck --declaration --emitDeclarationOnly "$(readlink -f "$path")"
# Rename from .gen.d.ts to .bs.d.ts so that someone importing the .bs.js file from
# vanilla JS also gets better IntelliSense
mv -f "$genDTsPath" "$bsDTsPath" |
Encountered this issue +1. The implementation in Is there any plan? I'm glad to help if the objective is clear |
This repository is being archived. If you feel like the issue still relevant, please re-create it in the compiler repo. Thanks! |
Hi @cristianoc
I noticed that most of the time in our codebase we are actually interested more in generating interface files (
.d.ts
) instead of.gen.tsx
. For this we havetsc
that generates.gen.js
and.d.gen.ts
from.gen.ts
.I think it will be amazing if genType will have a new mode that will print
.gen.js
and.d.gen.ts
right away. So that we can just ship reason packages ready to be consumed in any js libThe text was updated successfully, but these errors were encountered: