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

Commit

Permalink
feat: export types related to error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
brawaru committed Oct 9, 2023
1 parent df9b3be commit b8bf126
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
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'

0 comments on commit b8bf126

Please sign in to comment.