Skip to content

call to imported throw does not work on nested properties #45

Open

Description

@michaelangeloio

The following code works:

export const someObjectLiteral = {
  objectLiteralThrow({ someArg}: { someArg: string}) {
    throw new Error('hi khue')
  },
  nestedObjectLiteral: {
    nestedObjectLiteralThrow: () => {
      throw new Error('hi khue')
    },
  },
}

export const callToLiteral = () => {
  someObjectLiteral.nestedObjectLiteral.nestedObjectLiteralThrow()
  SomeObject.someExampleThrow()
}

However the following code does not:

import { someObjectLiteral } from './something'

export const callToLiteral = () => {
  someObjectLiteral.nestedObjectLiteral.nestedObjectLiteralThrow()
  SomeObject.someExampleThrow()
}

Most likely need to revisit the import_usage_finder.rs implementation to track nested properties as it visits the AST.
https://github.com/michaelangeloio/does-it-throw/blob/main/crates/does-it-throw/src/import_usage_finder.rs

Activity

  1. changed the title [-]calls to imported throws do not work on nested properties[/-] [+]call to imported throw does not work on nested properties[/+] on Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions