Skip to content
Snippets Groups Projects
Commit 709944c8 authored by Alexander Rose's avatar Alexander Rose
Browse files

typed DataLoci

parent 9341c19b
No related branches found
No related tags found
No related merge requests found
...@@ -32,9 +32,9 @@ export function isEmptyLoci(x?: Loci): x is EmptyLoci { ...@@ -32,9 +32,9 @@ export function isEmptyLoci(x?: Loci): x is EmptyLoci {
} }
/** A generic data loci */ /** A generic data loci */
export interface DataLoci { export interface DataLoci<T = unknown> {
readonly kind: 'data-loci', readonly kind: 'data-loci',
readonly data: any, readonly data: T,
readonly tag: string readonly tag: string
readonly indices: OrderedSet<number> readonly indices: OrderedSet<number>
} }
...@@ -47,7 +47,7 @@ export function areDataLociEqual(a: DataLoci, b: DataLoci) { ...@@ -47,7 +47,7 @@ export function areDataLociEqual(a: DataLoci, b: DataLoci) {
export function isDataLociEmpty(loci: DataLoci) { export function isDataLociEmpty(loci: DataLoci) {
return OrderedSet.size(loci.indices) === 0 ? true : false return OrderedSet.size(loci.indices) === 0 ? true : false
} }
export function createDataLoci(data: any, tag: string, indices: OrderedSet<number>): DataLoci { export function createDataLoci<T = unknown>(data: T, tag: string, indices: OrderedSet<number>): DataLoci<T> {
return { kind: 'data-loci', data, tag, indices } return { kind: 'data-loci', data, tag, indices }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment