The generated .$isTypeOf utility returns true when $type is missing/undefined. This makes the check looser than implied. social-app's legacy type utility dangerouslyIsType requires $type to be present. We'd like this behaviour in Lex codegen output too
Relevant code
|
isTypeOf<TValue extends Record<string, unknown>>( |
|
value: TValue, |
|
): value is MaybeTypedObject<TType, TValue> { |
|
return value.$type === undefined || value.$type === this.$type |
|
} |
The generated
.$isTypeOfutility returns true when$typeis missing/undefined. This makes the check looser than implied.social-app's legacy type utilitydangerouslyIsTyperequires$typeto be present. We'd like this behaviour in Lex codegen output tooRelevant code
atproto/packages/lex/lex-schema/src/schema/typed-object.ts
Lines 86 to 90 in 5043c7a