<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptClassDescription/type(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptClassDescription(im)typeForKey:"
  },
  "title" : "type(forKey:)"
}
-->

# type(forKey:)

Returns the name of the declared type of the attribute or relationship identified by the passed key.

```
func type(forKey key: String) -> String?
```

## Parameters

`key`

The identifying key for an attribute, one-to-one relationship, or one-to-many relationship of the receiver.

## Return Value

The name of the declared type of the attribute or relationship identified by `key`; for example, “NSString”. Searches in the receiver first, then in any superclass. Returns `nil` if no match is found.

## See Also

[`isReadOnlyKey:`](/documentation/Foundation/NSScriptClassDescription/isReadOnlyKey:)

Returns a Boolean value indicating whether a specified property in the receiver is read-only.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)