mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
748 B
TypeScript
35 lines
748 B
TypeScript
//// [tests/cases/compiler/constantOverloadFunction.ts] ////
|
|
|
|
//// [constantOverloadFunction.ts]
|
|
class Base { foo() { } }
|
|
class Derived1 extends Base { bar() { } }
|
|
class Derived2 extends Base { baz() { } }
|
|
class Derived3 extends Base { biz() { } }
|
|
|
|
function foo(tagName: 'canvas'): Derived1;
|
|
function foo(tagName: 'div'): Derived2;
|
|
function foo(tagName: 'span'): Derived3;
|
|
function foo(tagName: string): Base;
|
|
function foo(tagName: any): Base {
|
|
return null;
|
|
}
|
|
|
|
|
|
//// [constantOverloadFunction.js]
|
|
"use strict";
|
|
class Base {
|
|
foo() { }
|
|
}
|
|
class Derived1 extends Base {
|
|
bar() { }
|
|
}
|
|
class Derived2 extends Base {
|
|
baz() { }
|
|
}
|
|
class Derived3 extends Base {
|
|
biz() { }
|
|
}
|
|
function foo(tagName) {
|
|
return null;
|
|
}
|