This is probably an issue in more places but I noticed it on the list of triggers.
The following example code:
from inngest import TriggerEvent
from inngest.client import inngest_client
client = inngest_client("test")
triggers = [TriggerEvent(event="some_event")]
@client.create_function(fn_id="test_function", trigger=triggers)
async def test_function(context):
return "Hello world."
Gives this type error in VSCode
Argument of type "list[TriggerEvent]" cannot be assigned to parameter "trigger" of type "TriggerCron | TriggerEvent | list[TriggerCron | TriggerEvent]" in function "create_function"
Type "list[TriggerEvent]" is not assignable to type "TriggerCron | TriggerEvent | list[TriggerCron | TriggerEvent]"
"list[TriggerEvent]" is not assignable to "TriggerCron"
"list[TriggerEvent]" is not assignable to "TriggerEvent"
"list[TriggerEvent]" is not assignable to "list[TriggerCron | TriggerEvent]"
Type parameter "_T@list" is invariant, but "TriggerEvent" is not the same as "TriggerCron | TriggerEvent"
Consider switching from "list" to "Sequence" which is covariant
Switching to Sequence would solve the type error, and should work the same in code since the lists are never modified from what I can see.
This is probably an issue in more places but I noticed it on the list of triggers.
The following example code:
Gives this type error in VSCode
Switching to Sequence would solve the type error, and should work the same in code since the lists are never modified from what I can see.