returnsAPage

tcmts.cli.pages.returnsAPage · #kj5esuvx · term · runs anywhere

Whether a function returning this type can be an app's entry: a component's page (an element) or a main that sets the page up itself (nothing, or a promise of nothing).

export const returnsAPage = (type: string): boolean =>
  /^(void|undefined|Promise<void>|Promise<undefined>|(React\.)?(JSX\.)?Element|(React\.)?ReactNode|(React\.)?ReactElement(<.*>)?)$/.test(
    type,
  )

used by