diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).symbols b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).symbols new file mode 100644 index 0000000000000..53045141a745d --- /dev/null +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).symbols @@ -0,0 +1,49 @@ +//// [tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts] //// + +=== multipleBaseInterfaesWithIncompatibleProperties2.ts === +// https://github.com/microsoft/TypeScript/issues/62569 + +namespace http { +>http : Symbol(http, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 0, 0)) + + export interface TcpSocketConnectOpts { +>TcpSocketConnectOpts : Symbol(TcpSocketConnectOpts, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 2, 16)) + + port: number; +>port : Symbol(TcpSocketConnectOpts.port, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 3, 41)) + } + + export interface AgentOptions extends Partial { +>AgentOptions : Symbol(AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>TcpSocketConnectOpts : Symbol(TcpSocketConnectOpts, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 2, 16)) + + keepAlive?: boolean | undefined; +>keepAlive : Symbol(AgentOptions.keepAlive, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 7, 71)) + } +} + +namespace tls { +>tls : Symbol(tls, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 10, 1)) + + export interface ConnectionOptions { +>ConnectionOptions : Symbol(ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) + + port?: number | undefined; +>port : Symbol(ConnectionOptions.port, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 13, 38)) + } +} + +interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes +>AgentOptions : Symbol(AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 16, 1)) +>http.AgentOptions : Symbol(http.AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>http : Symbol(http, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 0, 0)) +>AgentOptions : Symbol(http.AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>tls.ConnectionOptions : Symbol(tls.ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) +>tls : Symbol(tls, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 10, 1)) +>ConnectionOptions : Symbol(tls.ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) + + maxCachedSessions?: number | undefined; +>maxCachedSessions : Symbol(AgentOptions.maxCachedSessions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 18, 73)) +} + diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).types b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).types new file mode 100644 index 0000000000000..7f6a9849b4098 --- /dev/null +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=false).types @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts] //// + +=== multipleBaseInterfaesWithIncompatibleProperties2.ts === +// https://github.com/microsoft/TypeScript/issues/62569 + +namespace http { + export interface TcpSocketConnectOpts { + port: number; +>port : number +> : ^^^^^^ + } + + export interface AgentOptions extends Partial { + keepAlive?: boolean | undefined; +>keepAlive : boolean | undefined +> : ^^^^^^^^^^^^^^^^^^^ + } +} + +namespace tls { + export interface ConnectionOptions { + port?: number | undefined; +>port : number | undefined +> : ^^^^^^^^^^^^^^^^^^ + } +} + +interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes +>http : any +> : ^^^ +>tls : any +> : ^^^ + + maxCachedSessions?: number | undefined; +>maxCachedSessions : number | undefined +> : ^^^^^^^^^^^^^^^^^^ +} + diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt new file mode 100644 index 0000000000000..6eb7241db278d --- /dev/null +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt @@ -0,0 +1,30 @@ +multipleBaseInterfaesWithIncompatibleProperties2.ts(19,11): error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. + Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. + + +==== multipleBaseInterfaesWithIncompatibleProperties2.ts (1 errors) ==== + // https://github.com/microsoft/TypeScript/issues/62569 + + namespace http { + export interface TcpSocketConnectOpts { + port: number; + } + + export interface AgentOptions extends Partial { + keepAlive?: boolean | undefined; + } + } + + namespace tls { + export interface ConnectionOptions { + port?: number | undefined; + } + } + + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes + ~~~~~~~~~~~~ +!!! error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. +!!! error TS2320: Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. + maxCachedSessions?: number | undefined; + } + \ No newline at end of file diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).symbols b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).symbols new file mode 100644 index 0000000000000..53045141a745d --- /dev/null +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).symbols @@ -0,0 +1,49 @@ +//// [tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts] //// + +=== multipleBaseInterfaesWithIncompatibleProperties2.ts === +// https://github.com/microsoft/TypeScript/issues/62569 + +namespace http { +>http : Symbol(http, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 0, 0)) + + export interface TcpSocketConnectOpts { +>TcpSocketConnectOpts : Symbol(TcpSocketConnectOpts, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 2, 16)) + + port: number; +>port : Symbol(TcpSocketConnectOpts.port, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 3, 41)) + } + + export interface AgentOptions extends Partial { +>AgentOptions : Symbol(AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>TcpSocketConnectOpts : Symbol(TcpSocketConnectOpts, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 2, 16)) + + keepAlive?: boolean | undefined; +>keepAlive : Symbol(AgentOptions.keepAlive, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 7, 71)) + } +} + +namespace tls { +>tls : Symbol(tls, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 10, 1)) + + export interface ConnectionOptions { +>ConnectionOptions : Symbol(ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) + + port?: number | undefined; +>port : Symbol(ConnectionOptions.port, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 13, 38)) + } +} + +interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes +>AgentOptions : Symbol(AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 16, 1)) +>http.AgentOptions : Symbol(http.AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>http : Symbol(http, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 0, 0)) +>AgentOptions : Symbol(http.AgentOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 5, 3)) +>tls.ConnectionOptions : Symbol(tls.ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) +>tls : Symbol(tls, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 10, 1)) +>ConnectionOptions : Symbol(tls.ConnectionOptions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 12, 15)) + + maxCachedSessions?: number | undefined; +>maxCachedSessions : Symbol(AgentOptions.maxCachedSessions, Decl(multipleBaseInterfaesWithIncompatibleProperties2.ts, 18, 73)) +} + diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).types b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).types new file mode 100644 index 0000000000000..7f6a9849b4098 --- /dev/null +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).types @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts] //// + +=== multipleBaseInterfaesWithIncompatibleProperties2.ts === +// https://github.com/microsoft/TypeScript/issues/62569 + +namespace http { + export interface TcpSocketConnectOpts { + port: number; +>port : number +> : ^^^^^^ + } + + export interface AgentOptions extends Partial { + keepAlive?: boolean | undefined; +>keepAlive : boolean | undefined +> : ^^^^^^^^^^^^^^^^^^^ + } +} + +namespace tls { + export interface ConnectionOptions { + port?: number | undefined; +>port : number | undefined +> : ^^^^^^^^^^^^^^^^^^ + } +} + +interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes +>http : any +> : ^^^ +>tls : any +> : ^^^ + + maxCachedSessions?: number | undefined; +>maxCachedSessions : number | undefined +> : ^^^^^^^^^^^^^^^^^^ +} + diff --git a/tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts b/tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts new file mode 100644 index 0000000000000..2d85de4f27e32 --- /dev/null +++ b/tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties2.ts @@ -0,0 +1,25 @@ +// @strict: true +// @noEmit: true +// @exactOptionalPropertyTypes: true, false + +// https://github.com/microsoft/TypeScript/issues/62569 + +namespace http { + export interface TcpSocketConnectOpts { + port: number; + } + + export interface AgentOptions extends Partial { + keepAlive?: boolean | undefined; + } +} + +namespace tls { + export interface ConnectionOptions { + port?: number | undefined; + } +} + +interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes + maxCachedSessions?: number | undefined; +}