mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
38 lines
663 B
TypeScript
38 lines
663 B
TypeScript
//// [tests/cases/compiler/functionArgShadowing.ts] ////
|
|
|
|
//// [functionArgShadowing.ts]
|
|
class A { foo() { } }
|
|
class B { bar() { } }
|
|
function foo(x: A) {
|
|
var x: B = new B();
|
|
x.bar(); // the property bar does not exist on a value of type A
|
|
}
|
|
|
|
class C {
|
|
constructor(public p: number) {
|
|
var p: string;
|
|
|
|
var n: number = p;
|
|
}
|
|
}
|
|
|
|
//// [functionArgShadowing.js]
|
|
"use strict";
|
|
class A {
|
|
foo() { }
|
|
}
|
|
class B {
|
|
bar() { }
|
|
}
|
|
function foo(x) {
|
|
var x = new B();
|
|
x.bar(); // the property bar does not exist on a value of type A
|
|
}
|
|
class C {
|
|
constructor(p) {
|
|
this.p = p;
|
|
var p;
|
|
var n = p;
|
|
}
|
|
}
|