Open jrieken opened 1 week ago
Have runtime validation and never
for now. Could explore a shape using unique symbol
later but I don't know that it makes the usage any clearer.
Could explore a shape using unique symbol later but I don't know that it makes the usage any clearer.
I like unique symbol
but I couldn't get TS happy when I would use it in type Foo = typeof unique symbol;
@connor4312 do you know what I am doing wrong?
Unique symbols are pretty special. In for case I think they need to be contained in an interface, like interface MyOpaqueType { readonly _opaque: unique symbol }
. With this MyOpaqueType
will be type that a consumer cannot construct and is irreplacable (except with any
).
I have seen @isidorn pass a cancellation token as
toolInvocationToken
when callinginvoke
. I guess this is because of "looks like a token must be a token" thinking. We could rename the field or (my favourite) use a concrete type (class with private ctor) for this so that using a cancellation token or anything else yields a compile error