mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add extra test for extending multiple bases with incompatible optional property under EOPT (#62574)
This commit is contained in:
committed by
GitHub
parent
91b32ac281
commit
1112daead7
+49
@@ -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<TcpSocketConnectOpts> {
|
||||
>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))
|
||||
}
|
||||
|
||||
+38
@@ -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<TcpSocketConnectOpts> {
|
||||
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
|
||||
> : ^^^^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
+30
@@ -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<TcpSocketConnectOpts> {
|
||||
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;
|
||||
}
|
||||
|
||||
+49
@@ -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<TcpSocketConnectOpts> {
|
||||
>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))
|
||||
}
|
||||
|
||||
+38
@@ -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<TcpSocketConnectOpts> {
|
||||
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
|
||||
> : ^^^^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
@@ -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<TcpSocketConnectOpts> {
|
||||
keepAlive?: boolean | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
namespace tls {
|
||||
export interface ConnectionOptions {
|
||||
port?: number | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes
|
||||
maxCachedSessions?: number | undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user