codex-team / codex-team/editor.js

In type ToolConstructable a circular dependency

Open
#1,080 3 comments 0 reactions 0 assignees View on GitHub
bug types
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

There was a problem while developing plugin on the **typescript**. In type **ToolConstructable** a circular dependency occurs and it is impossible to write a suitable constructor.

type ToolConstructable = BaseToolConstructable | BlockToolConstructable | InlineToolConstructable;

```
interface BaseToolConstructable {
new (config: {api: API, config?: ToolSettings}): BaseTool;
}
```

```
interface BlockToolConstructable extends BaseToolConstructable{
new (config: {api: API, config: ToolConfig, data: BlockToolData}): BlockTool;
}
```

`InlineToolConstructable extends BaseToolConstructable {}`

It seems that the BlockToolConstructable does not override the constructor that inherited.
To avoid circular dependency, I had to redefine types as follows (not inherited from **BaseToolConstructable**):

```
type ToolConstructable = BaseToolConstructable | BlockToolConstructable;

interface BaseToolConstructable {...}
interface BlockToolConstructable {...}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.