Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Update parameter-metadata-accessor.ts to prevent TypeError: undefined… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Makkalay
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