node_modules/lit-analyzer/lib/index.cjs.js
/**
 * Checks whether a type is a lit directive.
 * It will return true if the type is a function that takes a Part type and returns a void.
 * @param type
 */
Checks whether a type is a lit directive.
It will return true if the type is a function that takes a Part type and returns a void.
@param type
Checks whether a type is a lit directive . It will return true if the type is a function that takes a Part type and returns a void . @param type
function isLitDirective(type) {
    switch (type.kind) {
        case tsSimpleType.SimpleTypeKind.ALIAS:
            return type.name === "DirectiveFn" || isLitDirective(type.target);
        case tsSimpleType.SimpleTypeKind.FUNCTION:
            return (type.kind === tsSimpleType.SimpleTypeKind.FUNCTION &&
                type.argTypes != null &&
                type.argTypes.length > 0 &&
                ["Part", "NodePart", "AttributePart", "PropertyPart"].includes(type.argTypes[0].type.name || "") &&
                type.returnType != null &&
                type.returnType.kind === tsSimpleType.SimpleTypeKind.VOID);
        case tsSimpleType.SimpleTypeKind.GENERIC_ARGUMENTS:
            return type.target.kind === tsSimpleType.SimpleTypeKind.FUNCTION && type.target.name === "Directive";
        default:
            return false;
    }
}
function isLitDirective ( type ) { switch ( type . kind ) { case tsSimpleType . SimpleTypeKind . ALIAS : return type . name === "DirectiveFn" || isLitDirective ( type . target ) ; case tsSimpleType . SimpleTypeKind . FUNCTION : return ( type . kind === tsSimpleType . SimpleTypeKind . FUNCTION && type . argTypes != null && type . argTypes . length > 0 && [ "Part" , "NodePart" , "AttributePart" , "PropertyPart" ] . includes ( type . argTypes [ 0 ] . type . name || "" ) && type . returnType != null && type . returnType . kind === tsSimpleType . SimpleTypeKind . VOID ) ; case tsSimpleType . SimpleTypeKind . GENERIC_ARGUMENTS : return type . target . kind === tsSimpleType . SimpleTypeKind . FUNCTION && type . target . name === "Directive" ; default : return false ; } }
Checks whether a type is a lit directive.
Checks whether a type is a lit directive .
// Test for the built in type from lit-html: Directive<NodePart>