[TS] Fix importing module augmentations #13433
Labels
domain:ts
squad:core
Issue to be handled by the Core team.
type:task
This issue reports a chore (non-production change) and other types of "todos".
Milestone
We use module augmentation for adding properties to interfaces from
ckeditor5-core
with information provided by other packages:EditorConfig
- plugin-specific config is added there,PluginsMap
- it enableseditor.plugins.get()
to provide specific return type based on plugin name,CommandsMap
- it enableseditor.commands.get()
to provide specific return type based on command name and also checks the parameters ofeditor.execute()
.Return types are correctly provided at each call-site (
{config,plugins,commands}.get()
) only when the file with the properdeclare module '@ckeditor/ckeditor5-core'
is imported.However, it's not always imported directly, and the results are not-consistent. Visual Studio Code usually sees those augmentations and reports no error. But, when running automatic tests, the compilation fails randomly with
TypeScript emitted no output
error.Let's make sure that every augmentation is directly and explicitly imported:
plugin.get()
, the type of the plugin is imported. Make sure thatPluginsMap
is augmented in the same file as plugin class.commands.get()
, the type of the command is imported. Make sure thatCommandsMap
is augmented in the same file as command class.config.get()
, the plugin config should be imported. Ideally, the config should be in a single file likeckeditor5-mypackage/src/mypackageconfig.ts
.The text was updated successfully, but these errors were encountered: