UNPKG

core-types

Version:

Generic type declarations for e.g. TypeScript, GraphQL and JSON Schema

10 lines (9 loc) 705 B
import type { LineColumn, LocationOffset, LocationWithLineColumn } from './types.js'; export declare function positionToLineColumn(text: string, pos: number): LineColumn; export declare function locationToLineColumn(text: string, loc: LocationOffset | LocationWithLineColumn): LocationWithLineColumn; export declare function getPositionOffset<T extends LineColumn | number | undefined>(pos: T): T extends undefined ? undefined : number; /** * Use the smallest {start} and the biggest {end} to make a range consiting of * all locations */ export declare function mergeLocations(locations: Array<LocationOffset | LocationWithLineColumn | undefined>): LocationOffset | LocationWithLineColumn | undefined;