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

fix(types) Fix some type definition issues #3274

Merged
merged 6 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ const HLJS = function(hljs) {
}
}
do {
if (top.scope && !top.isMultiClass) {
if (top.scope) {
emitter.closeNode();
}
if (!top.skip && !top.subLanguage) {
Expand Down
12 changes: 6 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ declare module 'highlight.js' {
RE_STARTERS_RE: string
}

export type LanguageFn = (hljs?: HLJSApi) => Language
export type LanguageFn = (hljs: HLJSApi) => Language
export type CompilerExt = (mode: Mode, parent: Mode | Language | null) => void

export interface HighlightResult {
Expand Down Expand Up @@ -201,21 +201,21 @@ declare module 'highlight.js' {
illegalRe: RegExp
matcher: any
isCompiled: true
isMultiClass?: boolean
starts?: CompiledMode
parent?: CompiledMode
beginScope?: Record<number, string> & {_emit?: Record<number,boolean>, _multi?: boolean, _wrap?: string}
endScope?: Record<number, string> & {_emit?: Record<number,boolean>, _multi?: boolean, _wrap?: string}
}

interface ModeDetails {
begin?: RegExp | string
match?: RegExp | string
end?: RegExp | string
begin?: RegExp | string | (RegExp | string)[]
match?: RegExp | string | (RegExp | string)[]
end?: RegExp | string | (RegExp | string)[]
// deprecated in favor of `scope`
className?: string
_emit?: Record<number, boolean>
scope?: string | Record<number, string>
beginScope?: string | Record<number, string>
endScope?: string | Record<number, string>
contains?: ("self" | Mode)[]
endsParent?: boolean
endsWithParent?: boolean
Expand Down