Skip to content

Commit

Permalink
fix: references marked as external if path has dots (#1052)
Browse files Browse the repository at this point in the history
* fix: references marked as external if path has dots

Closes #1049

* refactor: ignore quotes in path

* Remove quotes from path since it breaks on Windows
  • Loading branch information
tsvetomir authored and Gerrit0 committed Jul 5, 2019
1 parent dfb7207 commit 07afa11
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib/converter/types/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ export class AliasConverter extends ConverterTypeComponent implements TypeNodeCo
}

const checker = context.checker;
let symbolName = checker.getFullyQualifiedName(type.symbol).split('.');
const fqn = checker.getFullyQualifiedName(type.symbol);

let symbolName = fqn.replace(/".*"\./, '').split('.');
if (!symbolName.length) {
return false;
}
if (symbolName[0].substr(0, 1) === '"') {
symbolName.shift();
}

let nodeName = node.typeName.getText().split('.');
if (!nodeName.length) {
Expand Down
7 changes: 7 additions & 0 deletions src/test/converter/dots.in.path/function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as types from './interface-empty';

/**
* This is a simple exported function.
*/
export function exportedFunction(arg: types.EmptyInterface): void {}

5 changes: 5 additions & 0 deletions src/test/converter/dots.in.path/interface-empty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* This is a simple interface
*/
export interface EmptyInterface {}

139 changes: 139 additions & 0 deletions src/test/converter/dots.in.path/specs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"id": 0,
"name": "typedoc",
"kind": 0,
"flags": {},
"children": [
{
"id": 3,
"name": "\"function\"",
"kind": 1,
"kindString": "External module",
"flags": {
"isExported": true
},
"originalName": "%BASE%/dots.in.path/function.ts",
"children": [
{
"id": 4,
"name": "exportedFunction",
"kind": 64,
"kindString": "Function",
"flags": {
"isExported": true
},
"signatures": [
{
"id": 5,
"name": "exportedFunction",
"kind": 4096,
"kindString": "Call signature",
"flags": {},
"comment": {
"shortText": "This is a simple exported function."
},
"parameters": [
{
"id": 6,
"name": "arg",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "reference",
"name": "EmptyInterface",
"id": 2
}
}
],
"type": {
"type": "intrinsic",
"name": "void"
}
}
],
"sources": [
{
"fileName": "function.ts",
"line": 6,
"character": 32
}
]
}
],
"groups": [
{
"title": "Functions",
"kind": 64,
"children": [
4
]
}
],
"sources": [
{
"fileName": "function.ts",
"line": 1,
"character": 0
}
]
},
{
"id": 1,
"name": "\"interface-empty\"",
"kind": 1,
"kindString": "External module",
"flags": {
"isExported": true
},
"originalName": "%BASE%/dots.in.path/interface-empty.ts",
"children": [
{
"id": 2,
"name": "EmptyInterface",
"kind": 256,
"kindString": "Interface",
"flags": {
"isExported": true
},
"comment": {
"shortText": "This is a simple interface"
},
"sources": [
{
"fileName": "interface-empty.ts",
"line": 4,
"character": 31
}
]
}
],
"groups": [
{
"title": "Interfaces",
"kind": 256,
"children": [
2
]
}
],
"sources": [
{
"fileName": "interface-empty.ts",
"line": 1,
"character": 0
}
]
}
],
"groups": [
{
"title": "External modules",
"kind": 1,
"children": [
3,
1
]
}
]
}

0 comments on commit 07afa11

Please sign in to comment.