Skip to content

Commit bb80aec

Browse files
author
Oleg Schelykalnov
committed
Test for unresolved generics
Testcase from #380
1 parent e55f298 commit bb80aec

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

  • typescript-generator-core/src/test/java/cz/habarta/typescript/generator

typescript-generator-core/src/test/java/cz/habarta/typescript/generator/GenericsTest.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,41 @@ class Page2 {
223223
class TableGA<T> {
224224
public T[] rows;
225225
}
226-
226+
227227
interface ExecutionResult {
228228
public <T extends Number> T getData();
229229
}
230230

231+
@Test
232+
public void testResolveParameter() {
233+
final Settings settings = TestUtils.settings();
234+
final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(Entity1View.class));
235+
final String nl = settings.newline;
236+
final String expected =
237+
"interface Entity1View extends Entity1IdView {" + nl +
238+
" name: string;" + nl +
239+
"}" + nl +
240+
nl +
241+
"interface Entity1IdView extends IdView<string> {" + nl +
242+
"}" + nl +
243+
nl +
244+
"interface IdView<T extends string> {" + nl +
245+
" id: T;" + nl +
246+
"}";
247+
assertEquals(expected, output.trim());
248+
}
249+
250+
public interface IdView<T extends String> {
251+
T getId();
252+
}
253+
254+
public interface Entity1IdView extends IdView<String> {
255+
}
256+
257+
public abstract class Entity1View implements Entity1IdView {
258+
private String name;
259+
260+
public String getName() { return name; }
261+
}
262+
231263
}

0 commit comments

Comments
 (0)