mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Test:declaration emit of optional parameter props
This commit is contained in:
parent
433a06d599
commit
5780494ddb
@ -0,0 +1,24 @@
|
||||
//// [declarationEmitParameterProperty.ts]
|
||||
export class Foo {
|
||||
constructor(public bar?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitParameterProperty.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var Foo = (function () {
|
||||
function Foo(bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
return Foo;
|
||||
}());
|
||||
exports.Foo = Foo;
|
||||
|
||||
|
||||
//// [declarationEmitParameterProperty.d.ts]
|
||||
export declare class Foo {
|
||||
bar: string | undefined;
|
||||
constructor(bar?: string | undefined);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/declarationEmitParameterProperty.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(declarationEmitParameterProperty.ts, 0, 0))
|
||||
|
||||
constructor(public bar?: string) {
|
||||
>bar : Symbol(Foo.bar, Decl(declarationEmitParameterProperty.ts, 1, 14))
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/declarationEmitParameterProperty.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
constructor(public bar?: string) {
|
||||
>bar : string | undefined
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,12 +131,12 @@ interface Foo {
|
||||
}
|
||||
declare function test1(x: Foo): void;
|
||||
declare class Bar {
|
||||
d: number;
|
||||
d: number | undefined;
|
||||
e: number;
|
||||
a: number;
|
||||
b?: number;
|
||||
c?: number | undefined;
|
||||
constructor(d?: number, e?: number);
|
||||
constructor(d?: number | undefined, e?: number);
|
||||
f(): number;
|
||||
g?(): number;
|
||||
h?(): number;
|
||||
|
||||
6
tests/cases/compiler/declarationEmitParameterProperty.ts
Normal file
6
tests/cases/compiler/declarationEmitParameterProperty.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// @strictNullChecks: true
|
||||
// @declaration: true
|
||||
export class Foo {
|
||||
constructor(public bar?: string) {
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user