Skip to content

Troubleshooting This and this

Capitalized This is a Lowgile alias for the module that represents the current app. Lowercase this is the TypeScript keyword whose value depends on how a function or method is called.

Tip

For a fuller explanation, see Understanding This and this in Lowgile.

Use this page to diagnose errors caused by using the wrong form. This and this are not interchangeable.

Symptoms

  • An expression intended to access a module object uses this. and fails validation.
  • A module-level object, such as Materials, cannot be found.
  • Code fails when it attempts to access the module object.

Cause

Lowercase this was used as though it were a Lowgile module alias.

Incorrect:

return this.Materials.getEntryList()

Resolution

Use capitalized This when the expression refers to an object defined in the current app module.

Correct:

return This.Materials.getEntryList()

Insight

In the Lowgile Console, This refers to the module selected in the module context selector. Confirm that the correct module is selected before running the expression.

2. A property on the current object cannot be resolved

Section titled “2. A property on the current object cannot be resolved”

Symptoms

  • An expression such as This.name does not resolve a property expected on an object instance.

Cause

Capitalized This was used where the code needs the object associated with the current function or method call. This resolves to the app module rather than the object on which the function or method was called.

Incorrect:

const request = {
reference: "PR-1001",
getReference() {
return This.reference
}
}
return request.getReference()

Resolution

Use lowercase this when the function or method is called with the intended object as its this value.

Correct:

const request = {
reference: "PR-1001",
getReference() {
return this.reference
}
}
return request.getReference()
  • Use This to reference the current app module.
  • Use this to reference the object bound by the JavaScript runtime, when that binding is appropriate.
  • In the Console, check the selected module context before using This.

Do not change capitalization merely to silence an error. First determine whether the expression should reference a module-level object or a runtime object.