import type { Parser } from "../api.js" ; import { parseError } from "../error.js" ; export const expect = < T > ( parser , err ) : Parser < T > => ( ctx ) => parser ( ctx ) || parseError ( ctx , err ) ;