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

typeParameters is not coming through #19

Open
mellis481 opened this issue Feb 23, 2022 · 1 comment
Open

typeParameters is not coming through #19

mellis481 opened this issue Feb 23, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@mellis481
Copy link

After integrating environment-enforcer into my repo, I'm seeing typeParameters is not coming through here resulting in the following error:

This macro requires you to explicitly pass the type parameter for the interface that defines the contract for which each environment variable file must adhere to. However, we did not find a type parameter for this node: {"type":"CallExpression","callee":{"type":"Identifier","name":"cov_78iegp7dg"},"arguments":[]}"

As you can see, p.node (logged above) has no typeParameters prop.

In the unit tests in this repo, I see that p.node is:

 {
        type: 'CallExpression',
        start: 136,
        end: 173,
        loc: SourceLocation {
          start: Position { line: 7, column: 23 },
          end: Position { line: 7, column: 60 },
          filename: undefined,
          identifierName: undefined
        },
        range: undefined,
        leadingComments: undefined,
        trailingComments: undefined,
        innerComments: undefined,
        extra: undefined,
        callee: Node {
          type: 'MemberExpression',
          start: 136,
          end: 161,
          loc: SourceLocation {
            start: [Position],
            end: [Position],
            filename: undefined,
            identifierName: undefined
          },
          range: undefined,
          leadingComments: undefined,
          trailingComments: undefined,
          innerComments: undefined,
          extra: undefined,
          object: Node {
            type: 'Identifier',
            start: 136,
            end: 155,
            loc: [SourceLocation],
            range: undefined,
            leadingComments: undefined,
            trailingComments: undefined,
            innerComments: undefined,
            extra: undefined,
            name: 'EnvironmentEnforcer'
          },
          computed: false,
          property: Node {
            type: 'Identifier',
            start: 156,
            end: 161,
            loc: [SourceLocation],
            range: undefined,
            leadingComments: undefined,
            trailingComments: undefined,
            innerComments: undefined,
            extra: undefined,
            name: 'parse'
          }
        },
        arguments: [],
        typeParameters: Node {
          type: 'TSTypeParameterInstantiation',
          start: 161,
          end: 171,
          loc: SourceLocation {
            start: [Position],
            end: [Position],
            filename: undefined,
            identifierName: undefined
          },
          range: undefined,
          leadingComments: undefined,
          trailingComments: undefined,
          innerComments: undefined,
          extra: undefined,
          params: [ [Node] ]
        }
      }

I'm unclear why typeParameters are not being passed through successfully.

@dgreene1
Copy link
Owner

The issue is not actually the type parameter but instead that it can’t find your environment variable file. The order of the error checks is off. I’m open to PRs. At the moment I’m not sure when a fix will be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants