Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-deer-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'dts-buddy': patch
---

fix: don't treat accessors as references
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ export function is_reference(node, include_declarations = false) {

if (ts.isImportTypeNode(node.parent)) return false;
if (ts.isPropertySignature(node.parent)) return false;
if (ts.isGetAccessor(node.parent)) return false;
if (ts.isSetAccessor(node.parent)) return false;
if (ts.isParameter(node.parent)) return false;
if (ts.isMethodDeclaration(node.parent)) return false;
if (ts.isLabeledStatement(node.parent)) return false;
Expand Down
1 change: 1 addition & 0 deletions test/samples/no-renames/input/function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function bar() {}
6 changes: 6 additions & 0 deletions test/samples/no-renames/input/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ export { Y } from './type';
export { Namespace } from './namespace';
export type X = true;
export function error(): void {}

export interface Foo {
get bar(): number;
set bar(x: number);
}
export * from './function';
5 changes: 5 additions & 0 deletions test/samples/no-renames/output/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
declare module 'no-renames' {
export type X = true;
export function error(): void;
export interface Foo {
get bar(): number;
set bar(x: number);
}
export type Y = Namespace.X;
export namespace Namespace {
interface X {
error(): string;
}
}
export function bar(): void;

export {};
}
Expand Down
10 changes: 7 additions & 3 deletions test/samples/no-renames/output/index.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
"names": [
"X",
"error",
"Foo",
"Y",
"Namespace"
"Namespace",
"bar"
],
"sources": [
"../input/index.ts",
"../input/type.ts",
"../input/namespace.ts"
"../input/namespace.ts",
"../input/function.ts"
],
"sourcesContent": [
null,
null,
null,
null
],
"mappings": ";aAEYA,CAACA;iBACGC,KAAKA;aCDTC,CAACA;kBCFIC,SAASA"
"mappings": ";aAEYA,CAACA;iBACGC,KAAKA;kBAEJC,GAAGA;;;;aCHRC,CAACA;kBCFIC,SAASA;;;;;iBCAVC,GAAGA"
}