Skip to content

Error message of generics with default value is not clear#146

Description

@jitsedesmet

Issue type:

  • 馃悰 Bug

Description:

I had an issue where I had a class that was not generic, but should have a generic type with default value.
This case, where it apparently needed to have this generic was hard too discover because the error message is not very clear.

For example, when I have a class like:

export abstract class ActorExpressionEvaluatorFactory extends

that should have a generic type like:

export abstract class ActorExpressionEvaluatorFactory<TS = undefined> extends

I would get the exception:

error: Detected fatal error. Generated 'componentsjs-error-state.json' with more information.
      TypeError: Cannot read properties of undefined (reading 'term')
          at ParameterPropertyHandlerRange.hasType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:418:19)
          at typeTypeValidator (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:435:26)
          at GenericsContext.mergeRanges (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/GenericsContext.js:123:14)
          at ParameterPropertyHandlerRange.hasType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:469:60)
          at ParameterPropertyHandlerRange.hasType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:488:42)
          at ParameterPropertyHandlerRange.hasType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:488:42)
          at ParameterPropertyHandlerRange.hasValueType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:86:47)
          at ParameterPropertyHandlerRange.hasValueType (/home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:291:38)
          at /home/jitsedesmet/Documents/werken/ugent/comunica/node_modules/componentsjs/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.js:104:18
          at Array.map (<anonymous>)

(Sorry if this description isn't very clear)


Environment:

Crash log:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions