Skip to content

@arcmantle/lit-jsx / compiler/type-utils

compiler/type-utils

Functions

isClassByType()

isClassByType(path, filename, code): boolean | undefined

Defined in: compiler/type-utils.ts:110

Checks if a JSX element refers to a class (not a string literal) based on TypeScript type information.

Returns:

  • true if the element is a class constructor (should use .tagName accessor)
  • false if the element is a string literal or function component
  • undefined if type checking is not available or the type cannot be determined

Parameters

path

NodePath<JSXElement>

filename

string

code

string

Returns

boolean | undefined


isClassOrCustomElementByType()

isClassOrCustomElementByType(path, filename, code): boolean | undefined

Defined in: compiler/type-utils.ts:19

Checks if a JSX element refers to a class or custom element based on TypeScript type information.

Returns:

  • true if the element is a class constructor or string literal (should be treated as static/custom element)
  • false if the element is a function component (should be treated as dynamic)
  • undefined if type checking is not available or the type cannot be determined

Parameters

path

NodePath<JSXElement>

filename

string

code

string

Returns

boolean | undefined

Released under the Apache-2.0 License.