Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Expose types correctly and add support for generic annotations #60

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

joelpoloney
Copy link

Fixed 2 things:

  1. The TypeScript definitions were not being exposed correctly, the change to package.json fixes that. I followed the instructions at https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html.
  2. Expose the key property that is provided to renderHighlight -- this definition was out of date.

Added new:

  1. Support for generic IAnnotation objects so you can use your own version of the Annotation object and include your own data outside of just text and an id. You use it like this:
    import { IAnnotation } from 'react-image-annotation'
    
    export interface MyAnnotation extends Omit<IAnnotation, 'data'> {
      data: {
        id?: string
        updatedAt: Date
        type: string
        userVisibleName: string
        metadata: Record<string, unknown>
      }
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant