Open busma13 opened 3 weeks ago
instanceof
works by checking the object's prototype chain against the prototype of the specified constructor function. This means it needs access to the actual constructor function of the class.
The issue is that the last update to v1.0.0
in file-asset-apis
changed these exports to just export the type
instead of the actual class.
Another thing I learned about types is that they do not exist at runtime, so they are not properties of the imported object. Meaning you can only use types for checking and defining structure but cannot access them as actual values or properties at runtime. The way we're using them here is trying to access the imported object S3ClientResponse
then looking in the object for a NoSuchKey
type property, but again the don't exist at runtime. Hence the error saying the property doesn't exist.
Solution: Update file-asset-apis
to export the full classes so we can use them in teraslice. This could be a separate export called client-classes
that we would use instead. Or we could just rename client-types
to client-classes
and have the dev using file-asset-apis
to import the types using import types
Yes, types only exist for type checking and do not exist in runtime unless its an enum, that translates to an actual value. If you need the actual things, then all you need to do is change export type {
to export {
.
I agree with the notion of changing the name of the top level directory as client-types make you think they are all types. Maybe just change it to native-client-helpers
or the like, make sure to change client-params
as well as client-repsonse
to remove the type
When updating
file-asset-apis
to v 1.0.0 interaslice/terafoundation
there are 2 type errors:I can navigate to
client-response.d.ts
and the types are present.