Run-time Types
let intType: Type = Type<Int>()resource Collectible {}
let collectibleType = Type<@Collectible>()
// `collectibleType` has type `Type`Type<Int>() == Type<Int>()
Type<Int>() != Type<String>()// Declare a variable named `collectible` that has the *static* type `Collectible`
// and has a resource of type `Collectible`
//
let collectible: @Collectible <- create Collectible()
// The resource is an instance of type `Collectible`,
// because the concrete run-time type is `Collectible`
//
collectible.isInstance(Type<@Collectible>()) // is `true`
// The resource is an instance of type `AnyResource`,
// because the concrete run-time type `Collectible` is a subtype of `AnyResource`
//
collectible.isInstance(Type<@AnyResource>()) // is `true`
// The resource is *not* an instance of type `String`,
// because the concrete run-time type `Collectible` is *not* a subtype of `String`
//
collectible.isInstance(Type<String>()) // is `false`Last updated