Skip to content

Commit 719446c

Browse files
TimvdLippeCommit Bot
authored and
Commit Bot
committed
Include workaround for TypeScript compiler bug
The TypeScript compiler has a bug where, when you implement an interface in JSDoc which is defined in a `.d.ts` file which uses a namespace, it generates an invalid declaration file [1]. To workaround this bug, we have to add global interfaces that are essentially aliases of the actual interfaces. As a result, the TypeScript compiler no longer fails with resolving. Update Closure accordingly such that we can use the correct type to work in both Closure and TypeScript. [1]: microsoft/TypeScript#38640 [email protected],[email protected] [email protected],[email protected] Bug: 1081686, 1011811 Change-Id: I088a4520c90ce0873cf9850a8ed65f9c8dd896ef Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2208978 Reviewed-by: Paul Lewis <[email protected]> Commit-Queue: Tim van der Lippe <[email protected]>
1 parent 7b92165 commit 719446c

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

front_end/generated/protocol-proxy-api.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3629,3 +3629,51 @@ declare namespace ProtocolProxyApi {
36293629
}
36303630
export interface SchemaDispatcher extends Protocol.Dispatcher {}
36313631
}
3632+
3633+
// Include the workaround for https://github.com/microsoft/TypeScript/issues/38640
3634+
interface ProtocolProxyApiWorkaround_AccessibilityDispatcher extends ProtocolProxyApi.AccessibilityDispatcher {}
3635+
interface ProtocolProxyApiWorkaround_AnimationDispatcher extends ProtocolProxyApi.AnimationDispatcher {}
3636+
interface ProtocolProxyApiWorkaround_ApplicationCacheDispatcher extends ProtocolProxyApi.ApplicationCacheDispatcher {}
3637+
interface ProtocolProxyApiWorkaround_AuditsDispatcher extends ProtocolProxyApi.AuditsDispatcher {}
3638+
interface ProtocolProxyApiWorkaround_BackgroundServiceDispatcher extends ProtocolProxyApi.BackgroundServiceDispatcher {}
3639+
interface ProtocolProxyApiWorkaround_BrowserDispatcher extends ProtocolProxyApi.BrowserDispatcher {}
3640+
interface ProtocolProxyApiWorkaround_CSSDispatcher extends ProtocolProxyApi.CSSDispatcher {}
3641+
interface ProtocolProxyApiWorkaround_CacheStorageDispatcher extends ProtocolProxyApi.CacheStorageDispatcher {}
3642+
interface ProtocolProxyApiWorkaround_CastDispatcher extends ProtocolProxyApi.CastDispatcher {}
3643+
interface ProtocolProxyApiWorkaround_DOMDispatcher extends ProtocolProxyApi.DOMDispatcher {}
3644+
interface ProtocolProxyApiWorkaround_DOMDebuggerDispatcher extends ProtocolProxyApi.DOMDebuggerDispatcher {}
3645+
interface ProtocolProxyApiWorkaround_DOMSnapshotDispatcher extends ProtocolProxyApi.DOMSnapshotDispatcher {}
3646+
interface ProtocolProxyApiWorkaround_DOMStorageDispatcher extends ProtocolProxyApi.DOMStorageDispatcher {}
3647+
interface ProtocolProxyApiWorkaround_DatabaseDispatcher extends ProtocolProxyApi.DatabaseDispatcher {}
3648+
interface ProtocolProxyApiWorkaround_DeviceOrientationDispatcher extends ProtocolProxyApi.DeviceOrientationDispatcher {}
3649+
interface ProtocolProxyApiWorkaround_EmulationDispatcher extends ProtocolProxyApi.EmulationDispatcher {}
3650+
interface ProtocolProxyApiWorkaround_HeadlessExperimentalDispatcher extends
3651+
ProtocolProxyApi.HeadlessExperimentalDispatcher {}
3652+
interface ProtocolProxyApiWorkaround_IODispatcher extends ProtocolProxyApi.IODispatcher {}
3653+
interface ProtocolProxyApiWorkaround_IndexedDBDispatcher extends ProtocolProxyApi.IndexedDBDispatcher {}
3654+
interface ProtocolProxyApiWorkaround_InputDispatcher extends ProtocolProxyApi.InputDispatcher {}
3655+
interface ProtocolProxyApiWorkaround_InspectorDispatcher extends ProtocolProxyApi.InspectorDispatcher {}
3656+
interface ProtocolProxyApiWorkaround_LayerTreeDispatcher extends ProtocolProxyApi.LayerTreeDispatcher {}
3657+
interface ProtocolProxyApiWorkaround_LogDispatcher extends ProtocolProxyApi.LogDispatcher {}
3658+
interface ProtocolProxyApiWorkaround_MemoryDispatcher extends ProtocolProxyApi.MemoryDispatcher {}
3659+
interface ProtocolProxyApiWorkaround_NetworkDispatcher extends ProtocolProxyApi.NetworkDispatcher {}
3660+
interface ProtocolProxyApiWorkaround_OverlayDispatcher extends ProtocolProxyApi.OverlayDispatcher {}
3661+
interface ProtocolProxyApiWorkaround_PageDispatcher extends ProtocolProxyApi.PageDispatcher {}
3662+
interface ProtocolProxyApiWorkaround_PerformanceDispatcher extends ProtocolProxyApi.PerformanceDispatcher {}
3663+
interface ProtocolProxyApiWorkaround_SecurityDispatcher extends ProtocolProxyApi.SecurityDispatcher {}
3664+
interface ProtocolProxyApiWorkaround_ServiceWorkerDispatcher extends ProtocolProxyApi.ServiceWorkerDispatcher {}
3665+
interface ProtocolProxyApiWorkaround_StorageDispatcher extends ProtocolProxyApi.StorageDispatcher {}
3666+
interface ProtocolProxyApiWorkaround_SystemInfoDispatcher extends ProtocolProxyApi.SystemInfoDispatcher {}
3667+
interface ProtocolProxyApiWorkaround_TargetDispatcher extends ProtocolProxyApi.TargetDispatcher {}
3668+
interface ProtocolProxyApiWorkaround_TetheringDispatcher extends ProtocolProxyApi.TetheringDispatcher {}
3669+
interface ProtocolProxyApiWorkaround_TracingDispatcher extends ProtocolProxyApi.TracingDispatcher {}
3670+
interface ProtocolProxyApiWorkaround_FetchDispatcher extends ProtocolProxyApi.FetchDispatcher {}
3671+
interface ProtocolProxyApiWorkaround_WebAudioDispatcher extends ProtocolProxyApi.WebAudioDispatcher {}
3672+
interface ProtocolProxyApiWorkaround_WebAuthnDispatcher extends ProtocolProxyApi.WebAuthnDispatcher {}
3673+
interface ProtocolProxyApiWorkaround_MediaDispatcher extends ProtocolProxyApi.MediaDispatcher {}
3674+
interface ProtocolProxyApiWorkaround_ConsoleDispatcher extends ProtocolProxyApi.ConsoleDispatcher {}
3675+
interface ProtocolProxyApiWorkaround_DebuggerDispatcher extends ProtocolProxyApi.DebuggerDispatcher {}
3676+
interface ProtocolProxyApiWorkaround_HeapProfilerDispatcher extends ProtocolProxyApi.HeapProfilerDispatcher {}
3677+
interface ProtocolProxyApiWorkaround_ProfilerDispatcher extends ProtocolProxyApi.ProfilerDispatcher {}
3678+
interface ProtocolProxyApiWorkaround_RuntimeDispatcher extends ProtocolProxyApi.RuntimeDispatcher {}
3679+
interface ProtocolProxyApiWorkaround_SchemaDispatcher extends ProtocolProxyApi.SchemaDispatcher {}

scripts/build/generate_protocol_externs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ def generate_protocol_externs(output_path, file1, file2):
280280
output_file.write("/** @interface */\n")
281281
output_file.write("ProtocolProxyApi.%sDispatcher = function() {};\n" %
282282
domain_name)
283+
# Include the workaround for https://github.com/microsoft/TypeScript/issues/38640
284+
output_file.write(
285+
"var ProtocolProxyApiWorkaround_%sDispatcher = ProtocolProxyApi.%sDispatcher;\n"
286+
% (domain_name, domain_name))
283287
if "events" in domain:
284288
for event in domain["events"]:
285289
params = []

scripts/protocol_typescript/protocol_dts_generator.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@ const emitApi = (moduleName: string, protocolModuleName: string, domains: Protoc
402402
domains.forEach(d => emitDomainApi(d, protocolModulePrefix));
403403
emitCloseBlock();
404404
emitLine();
405+
406+
emitLine('// Include the workaround for https://github.com/microsoft/TypeScript/issues/38640');
407+
domains.forEach(d => {
408+
emitLine(
409+
`interface ProtocolProxyApiWorkaround_${d.domain}Dispatcher extends ProtocolProxyApi.${d.domain}Dispatcher {}`);
410+
});
405411
};
406412

407413
const flushEmitToFile = (path: string) => {

0 commit comments

Comments
 (0)