Skip to content

Add "removeExportFromDeclarations" definition file option. - #38

Merged
d0sboots merged 7 commits into
bitburner-official:mainfrom
danielmirchandani:main
Jul 8, 2026
Merged

Add "removeExportFromDeclarations" definition file option.#38
d0sboots merged 7 commits into
bitburner-official:mainfrom
danielmirchandani:main

Conversation

@danielmirchandani

Copy link
Copy Markdown
Contributor

Bitburner's Script Editor (using Monaco) provides types from the definition file ambiently. To do so, Bitburner modifies the definition file in this same way before providing it to Monaco (https://github.com/bitburner-official/bitburner-src/blob/2e83ba9ce9b688540d9f60cf4b0245fd53bea9e0/src/ScriptEditor/ui/Editor.tsx#L48). Now that Bitburner can execute TS natively, I would like the same experience outside of Bitburner when developing scripts. I currently need to strip import lines that refer to the unmodified definition file, or else sync the definition file back into Bitburner so scripts can refer to the modified definition file.

I think this should actually be the responsibility of Bitburner rather than RFA implementors, but the Bitburner team has already specified they won't fix this and consider it the responsibility of each RFA implementation (bitburner-official/bitburner-src#2471).

Bitburner's Script Editor (using Monaco) provides types from the definition file ambiently. To do so, Bitburner modifies the definition file in this same way before providing it to Monaco (https://github.com/bitburner-official/bitburner-src/blob/2e83ba9ce9b688540d9f60cf4b0245fd53bea9e0/src/ScriptEditor/ui/Editor.tsx#L48). Now that Bitburner can execute TS natively, I would like the same experience outside of Bitburner when developing scripts. I currently need to strip `import` lines that refer to the unmodified definition file, or else sync the definition file back into Bitburner so scripts can refer to the modified definition file.

I think this should actually be the responsibility of Bitburner rather than RFA implementors, but the Bitburner team has already specified they won't fix this and consider it the responsibility of each RFA implementation (bitburner-official/bitburner-src#2471).
@danielmirchandani

Copy link
Copy Markdown
Contributor Author

I've tested this by installing this modified package as a "file:" dependency in https://github.com/danielmirchandani/bitburner-typescript which is based on Bitburner's official typescript-template. Including the definition file in my "tsconfig.json" allows my scripts to use these types without an explicit import.

danielmirchandani added a commit to danielmirchandani/bitburner-typescript that referenced this pull request May 29, 2026
This relies on bitburner-official/bitburner-filesync#38 to make the inside and outside TS experiences as similar as possible.
@danielmirchandani

Copy link
Copy Markdown
Contributor Author

I ran npm run format and npm run lint. All tests in npm run test:all passed.

@catloversg catloversg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Add this new option to the config example in README.md.

Comment thread src/networking/messageHandler.ts Outdated
@danielmirchandani

Copy link
Copy Markdown
Contributor Author

Optional: Add this new option to the config example in README.md.

Done.

@danielmirchandani

Copy link
Copy Markdown
Contributor Author

Do you have any feedback on the name of the option, or the description? I admit it's a bit mysterious unless you already know why you need this option.

@catloversg

Copy link
Copy Markdown

"ambient" is not very descriptive, but I don't have any good suggestions. Maybe you should ask on Discord (the suggestion channel) for more feedback.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread src/config.ts Outdated
@danielmirchandani

Copy link
Copy Markdown
Contributor Author

@d0sboots

@d0sboots

d0sboots commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

I think the actions definitions are so old that they won't even run, so I won't hold that against you.

@d0sboots d0sboots changed the title Add "ambient" definition file option. Add "removeExportFromDeclarations" definition file option. Jul 8, 2026
@d0sboots
d0sboots merged commit d319c53 into bitburner-official:main Jul 8, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants