Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use array types for highlights and emphasis #1

Open
sliminality opened this issue Apr 15, 2022 · 0 comments
Open

Use array types for highlights and emphasis #1

sliminality opened this issue Apr 15, 2022 · 0 comments

Comments

@sliminality
Copy link

Great project! I wish I had something similar when I was debating.

In types.ts, it looks like you're using 1-tuples of 3-tuples to model rich text annotations:

emphasis: [[number, number, number]],

But from inspecting the API response, it looks like the intent is to model highlights as an array of 3-tuples:
image

I believe the current types conflate syntax for tuples and arrays:

  • T[] or Array<T> denotes an array of T
  • [T] denotes a 1-tuple with member T (see TypeScript docs on Arrays)

In this case, it may be more appropriate to model these types as arrays of 3-tuples:

export type Card = {
  
  body: string[],
  emphasis: [number, number, number][], // or Array<[number, number, number]>
  highlights: [number, number, number][],
  underlines: [number, number, number][],
  cite_emphasis?: [number, number][],
  
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant