Skip to content

Commit

Permalink
Docs(SCIMMY.Types.SchemaDefinition#attribute()): make return type gen…
Browse files Browse the repository at this point in the history
…eric
  • Loading branch information
sleelin committed Feb 24, 2025
1 parent 937e25a commit e8f09ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/types/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ export class SchemaDefinition {

/**
* Find an attribute or extension instance belonging to the schema definition by its name
* @template {SCIMMY.Types.Attribute|SCIMMY.Types.SchemaDefinition} [T=SCIMMY.Types.Attribute] - expected type of matching instance
* @param {String} name - the name of the attribute to look for (namespaced or direct)
* @returns {SCIMMY.Types.Attribute|SCIMMY.Types.SchemaDefinition} the Attribute or SchemaDefinition instance with matching name
* @returns {T} the Attribute or SchemaDefinition instance with matching name
*/
attribute(name) {
if (name.toLowerCase().startsWith("urn:")) {
Expand Down Expand Up @@ -118,7 +119,7 @@ export class SchemaDefinition {
// Evaluate the rest of the path
while (path.length > 0) {
// If the attribute isn't complex, it can't declare sub-attributes
if (attribute.type !== "complex")
if (String(attribute.type) !== "complex")
throw new TypeError(`Attribute '${spent.join(".")}' of schema '${this.id}' is not of type 'complex' and does not define any subAttributes`);

// Find the next attribute in the path
Expand Down

0 comments on commit e8f09ae

Please sign in to comment.