Skip to content

Cannot compile snippets with interfaces that have the same method name #30

@achingbrain

Description

@achingbrain

We have the following in our changelog:

* All interfaces now need to use method signature style rather than property function style

eg:
before
```ts
interface Foo {
  bar: (baz: number) => void
}
```
after
```ts
interface Foo {
  bar(baz: number): void
}
```

typescript-docs-verifier fails to compile this with:

Error compiling example code block 2 in file CHANGELOG.md:
  ⨯ Unable to compile TypeScript:
      CHANGELOG.md → Code Block 2:2:3 - error TS2300: Duplicate identifier 'bar'.
      
      2   bar(baz: number): void
          ~~~
      
        CHANGELOG.md → Code Block 2:2:3
          2   bar: (baz: number) => void
              ~~~
          'bar' was also declared here.
      
Original code:
     1| interface Foo {
     2|   bar(baz: number): void
     3| }
     4| 

I guess it's combining the two interface definitions?

Is there anyway to stop this from happening or otherwise treat the snippets as independent?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions