node_modules/lit-analyzer/lib/index.cjs.js
/**
 * Assignability check that simulates string coercion
 * This is used to type check attribute bindings
 * @param typeA
 * @param typeB
 * @param options
 */
Assignability check that simulates string coercion
This is used to type check attribute bindings
@param typeA
@param typeB
@param options
Assignability check that simulates string coercion This is used to type check attribute bindings @param typeA @param typeB @param options
function isAssignableToTypeWithStringCoercion(typeA, typeB, options) {
    var safeOptions = __assign(__assign({}, options), { isAssignable: undefined });
    switch (typeB.kind) {
        case tsSimpleType.SimpleTypeKind.ALIAS:
        case tsSimpleType.SimpleTypeKind.FUNCTION:
        case tsSimpleType.SimpleTypeKind.GENERIC_ARGUMENTS:
            if (isLitDirective(typeB)) {
                return true;
            }
            break;
        case tsSimpleType.SimpleTypeKind.OBJECT:
        case tsSimpleType.SimpleTypeKind.CLASS:
        case tsSimpleType.SimpleTypeKind.INTERFACE:
            return tsSimpleType.isAssignableToType(typeA, {
                kind: tsSimpleType.SimpleTypeKind.STRING_LITERAL,
                value: "[object Object]"
            }, safeOptions);
        case tsSimpleType.SimpleTypeKind.STRING_LITERAL:
            if (typeB.value.length === 0) {
                if (tsSimpleType.isAssignableToType(typeA, { kind: tsSimpleType.SimpleTypeKind.BOOLEAN_LITERAL, value: true }, safeOptions)) {
                    return true;
                }
            }
            if (!isNaN(typeB.value)) {
                if (tsSimpleType.isAssignableToType(typeA, {
                    kind: tsSimpleType.SimpleTypeKind.NUMBER_LITERAL,
                    value: Number(typeB.value)
                }, safeOptions)) {
                    return true;
                }
            }
            break;
        case tsSimpleType.SimpleTypeKind.BOOLEAN:
            return tsSimpleType.isAssignableToType(typeA, {
                kind: tsSimpleType.SimpleTypeKind.UNION,
                types: [
                    {
                        kind: tsSimpleType.SimpleTypeKind.STRING_LITERAL,
                        value: "true"
                    },
                    { kind: tsSimpleType.SimpleTypeKind.STRING_LITERAL, value: "false" }
                ]
            }, safeOptions);
        case tsSimpleType.SimpleTypeKind.BOOLEAN_LITERAL:
            return tsSimpleType.isAssignableToType(typeA, {
                kind: tsSimpleType.SimpleTypeKind.STRING_LITERAL,
                value: String(typeB.value)
            }, safeOptions);
        case tsSimpleType.SimpleTypeKind.NUMBER:
            if (tsSimpleType.isAssignableToType(typeA, { kind: tsSimpleType.SimpleTypeKind.STRING }, safeOptions)) {
                return true;
            }
            break;
        case tsSimpleType.SimpleTypeKind.NUMBER_LITERAL:
            if (tsSimpleType.isAssignableToType(typeA, {
                kind: tsSimpleType.SimpleTypeKind.STRING_LITERAL,
                value: String(typeB.value)
            }, safeOptions)) {
                return true;
            }
            break;
    }
    return undefined;
}
function isAssignableToTypeWithStringCoercion ( typeA , typeB , options ) { var safeOptions = __assign ( __assign ( { } , options ) , { isAssignable : undefined } ) ; switch ( typeB . kind ) { case tsSimpleType . SimpleTypeKind . ALIAS : case tsSimpleType . SimpleTypeKind . FUNCTION : case tsSimpleType . SimpleTypeKind . GENERIC_ARGUMENTS : if ( isLitDirective ( typeB ) ) { return true ; } break ; case tsSimpleType . SimpleTypeKind . OBJECT : case tsSimpleType . SimpleTypeKind . CLASS : case tsSimpleType . SimpleTypeKind . INTERFACE : return tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . STRING_LITERAL , value : "[object Object]" } , safeOptions ) ; case tsSimpleType . SimpleTypeKind . STRING_LITERAL : if ( typeB . value . length === 0 ) { if ( tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . BOOLEAN_LITERAL , value : true } , safeOptions ) ) { return true ; } } if ( ! isNaN ( typeB . value ) ) { if ( tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . NUMBER_LITERAL , value : Number ( typeB . value ) } , safeOptions ) ) { return true ; } } break ; case tsSimpleType . SimpleTypeKind . BOOLEAN : return tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . UNION , types : [ { kind : tsSimpleType . SimpleTypeKind . STRING_LITERAL , value : "true" } , { kind : tsSimpleType . SimpleTypeKind . STRING_LITERAL , value : "false" } ] } , safeOptions ) ; case tsSimpleType . SimpleTypeKind . BOOLEAN_LITERAL : return tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . STRING_LITERAL , value : String ( typeB . value ) } , safeOptions ) ; case tsSimpleType . SimpleTypeKind . NUMBER : if ( tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . STRING } , safeOptions ) ) { return true ; } break ; case tsSimpleType . SimpleTypeKind . NUMBER_LITERAL : if ( tsSimpleType . isAssignableToType ( typeA , { kind : tsSimpleType . SimpleTypeKind . STRING_LITERAL , value : String ( typeB . value ) } , safeOptions ) ) { return true ; } break ; } return undefined ; }
Assignability check that simulates string coercion
 This is used to type check attribute bindings
 @param typeA
 @param typeB
 @param options
Assignability check that simulates string coercion This is used to type check attribute bindings @param typeA @param typeB @param options
/*case SimpleTypeKind.NULL:
         return _isAssignableToType(typeA, { kind: SimpleTypeKind.STRING_LITERAL, value: "null" }, safeOptions);

         case SimpleTypeKind.UNDEFINED:
         return _isAssignableToType(typeA, { kind: SimpleTypeKind.STRING_LITERAL, value: "undefined" }, safeOptions);
         */ // Always return true if this is a lit directive // This allows for types like: string | (part: Part) => void // Take into account that the empty string is is equal to true // Test if a potential string literal is a assignable to a number // Example: max="123" // Test if a boolean coerced string is possible. // Example: aria-expanded="${this.open}" /**
             * Test if a boolean literal coerced to string is possible
             * Example: aria-expanded="${this.open}"
             */ // Test if a number coerced to string is possible // Example: value="${this.max}" // Test if a number literal coerced to string is possible // Example: value="${this.max}"