Skip to content

Incorrect Typing of parameter in "onSelection" #30

@MartinHaeusler

Description

@MartinHaeusler

According to the type information provided by react-codemirror2, the onSelection callback is defined as follows:

onSelection?: (editor: IInstance, ranges: ISetSelectionOptions) => void;

... where ISetSelectionOptions is defined as:

export interface ISetSelectionOptions {
    anchor: codemirror.Position;
    head: codemirror.Position;
}

However, when the listener is actually fired during runtime, the object I receive as the ranges parameter does not match the type outlined above. It is:

image

It's an object with a property ranges, which in turn is an array of ISetSelectionOptions.

I am using:

  • react-codemirror2: 3.0.3
  • codemirror: 5.31.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions