Ambient declarations not working due to import/export
See original GitHub issueThe import
and export
statements in danger.d.ts
are preventing the danger DSL from being available in the global scope:
This is a known issue in Typescript *.d.ts
files (ambient declarations):
https://github.com/microsoft/TypeScript/issues/28097
A potential solution per this comment is to wrap global declarations in a declare global { }
block.
EDIT: This appears to do the trick based on a quick test. Here’s a minimum set of changes: https://github.com/carmanchris31/danger-ambient-declarations-repro/commit/e897e351bb253505075606acc9fde51fc429776e?w=1
Where should one look in the code in order to attempt addressing this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
ambient module declaration with import - typescript
In an attempt to fix this I imported the proper type from a known library into the typings. d. ts this supplies the...
Read more >TypeScript Language Service having problems with ambient ...
a. In there use ambient interface without import, interface will be colored red, on hover the error will read "TS2304: Cannot find name...
Read more >Documentation - Modules - TypeScript
Any declaration (such as a variable, function, class, type alias, or interface) can be exported by adding the export keyword. StringValidator.ts. ts. export ......
Read more >TypeScript errors and how to fix them
To fix the problem you have to update the reference path to point to another ... TypeScript does not allow statements in such...
Read more >TypeScript Cheatsheet, Common Errors, and More
If using an ambient declaration file only for types interface Window ... implicit issues, as well as prevent errors related to mismatched ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We could provide a file that plugin authors could directly reference that would hook up that global scope?
Danger-plugin-interface.d.ts (not sure if that would work?)
wat?
without
import { DangerDSLType} from 'danger';
with
import { DangerDSLType} from 'danger';
it’s really strange that you’re injecting stuff into global space in the first place to be brutually honest.