Josh Goebel
Josh Goebel
Can someone recommend the right way to type this? https://github.com/highlightjs/highlight.js/blob/main/src/lib/regex.js#L77 The type of args is literally `(RegExp | string)[]` except the last params can *optinally* be a `RegexEitherOptions`.
``` type RegexEitherOptions = { more: boolean; } interface PublicApi { regex: { concat: (...args: (RegExp | string)[]) => string, lookahead: (re: RegExp | string) => string, either: (...args: (RegExp...
This snippet also seems to work just fine: ``` type RegexEitherOptions = { capture?: boolean } export function either(...args: (RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]) { const opts...
So right now I can't reproduce this error with the web version - is it no longer an issue in the latest TS versions?
I only write the types to use the linting features in VS Code... so if it worked when I wrote it - and evidently it works in the latest tsc...
The definition of variable likely needs to be tightened up: https://github.com/highlightjs/highlight.js/blob/fd307015164c05b191156efc378622293089c616/src/languages/gherkin.js#L34-L36 What are the exact syntax requirements for variables in Gherkin?
Great catch. Should be an easy fix - want to take a swing at making a PR for it?
One could use variants and expose custom matchers for ruled lines that match say `^***$`, etc... so that you could catch the most common cases... I wonder if the current...
What harm are the warnings?
Maybe use a union regex? ``` /^(no-?highlight|mermaid)$/i ```