+
Skip to content

Conversation

Maxttier
Copy link
Owner

TypeError: undefined is not an object (evaluating 'types[param.index]')

 class ParameterMetadataAccessor {
     explore(instance, prototype, method) {
         const types = Reflect.getMetadata(constants_1.PARAMTYPES_METADATA, instance, method.name);
         const routeArgsMetadata = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, instance.constructor, method.name) || {};
         const parametersWithType = (0, lodash_1.mapValues)((0, reverse_object_keys_util_1.reverseObjectKeys)(routeArgsMetadata), (param) => ({
             type: types[param.index],
                       ^
TypeError: undefined is not an object (evaluating 'types[param.index]')

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • [x ] Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

TypeError: undefined is not an object (evaluating 'types[param.index]')

Issue Number: N/A

What is the new behavior?

Set default type to string

Does this PR introduce a breaking change?

  • Yes
  • [x ] No

Other information

… is not an object (evaluating 'types[param.index]')

 class ParameterMetadataAccessor {
     explore(instance, prototype, method) {
         const types = Reflect.getMetadata(constants_1.PARAMTYPES_METADATA, instance, method.name);
         const routeArgsMetadata = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, instance.constructor, method.name) || {};
         const parametersWithType = (0, lodash_1.mapValues)((0, reverse_object_keys_util_1.reverseObjectKeys)(routeArgsMetadata), (param) => ({
             type: types[param.index],
                       ^
TypeError: undefined is not an object (evaluating 'types[param.index]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载