Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

feat: export types related to error handling #45

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/parser/error-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type ParserOptions,
} from '@formatjs/icu-messageformat-parser'

type ParseErrorHandlerResult = MessageFormatElement[] | undefined | void
export type ParseErrorHandlerResult = MessageFormatElement[] | undefined | void

/**
* A function that handles parsing error and either throws another error, or
Expand Down Expand Up @@ -39,7 +39,7 @@ export const builtinStrategies = {

Object.setPrototypeOf(builtinStrategies, null)

type ParseErrorHandlingStrategy = keyof typeof builtinStrategies
export type ParseErrorHandlingStrategy = keyof typeof builtinStrategies

export type ParseErrorHandlingOption =
| ParseErrorHandler
Expand All @@ -61,7 +61,7 @@ export function resolveParseErrorHandler(option: ParseErrorHandlingOption) {
throw new Error(`Cannot resolve built-in strategy with name "${option}"`)
}

interface ParseErrorContext {
export interface ParseErrorContext {
/** ID of the module that is being parsed. */
get moduleId(): string

Expand Down
2 changes: 2 additions & 0 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export {
resolveParseErrorHandler,
type ParseErrorHandler,
type ParseErrorHandlingOption,
type ParseErrorContext,
type ParseErrorHandlingStrategy,
} from './error-handling.ts'
8 changes: 7 additions & 1 deletion src/secondary-exports.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export { AnyMessage } from './parser/index.ts'
export {
AnyMessage,
type ParseErrorContext,
type ParseErrorHandler,
type ParseErrorHandlingOption,
type ParseErrorHandlingStrategy,
} from './parser/index.ts'