Skip to content

Commit

Permalink
fix(interfaces): [Point] ensure offset is a number
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Mar 3, 2023
1 parent c9db65a commit 6a9fcae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/interfaces/__tests__/point.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ describe('unit-d:interfaces/Point', () => {
it('should extend Required<unist.Point>', () => {
expectTypeOf<TestSubject>().toMatchTypeOf<Required<unist.Point>>()
})

it('should match [offset: number]', () => {
expectTypeOf<TestSubject>().toHaveProperty('offset').toBeNumber()
})
})
7 changes: 6 additions & 1 deletion src/interfaces/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import type unist from 'unist'
*
* @extends {Required<unist.Point>}
*/
interface Point extends Required<unist.Point> {}
interface Point extends Required<unist.Point> {
/**
* Index of character in a source file (0-indexed integer).
*/
offset: number
}

export type { Point as default }

0 comments on commit 6a9fcae

Please sign in to comment.