【发布时间】:2019-02-21 23:29:39
【问题描述】:
我正在将 TypeScript 与 React 一起使用,我想要实现的一件事是后台同步以提供离线支持。
要为 service worker 启用类型,我必须包含 WebWorker 库,但它与 DOM 库冲突并产生错误:
(25,1): Definitions of the following identifiers conflict with those in another file:
EventListenerOrEventListenerObject, BlobPart, HeadersInit, BodyInit,
RequestInfo, DOMHighResTimeStamp, PerformanceEntryList, PushMessageDataInit,
VibratePattern, BufferSource, DOMTimeStamp, FormDataEntryValue,
IDBValidKey, MessageEventSource, BinaryType, ClientTypes,
IDBCursorDirection, IDBRequestReadyState, IDBTransactionMode,
NotificationDirection, NotificationPermission, PushEncryptionKeyName,
PushPermissionState, ReferrerPolicy, RequestCache, RequestCredentials,
RequestDestination, RequestMode, RequestRedirect, ResponseType,
ServiceWorkerState, ServiceWorkerUpdateViaCache, VisibilityState,
WorkerType, XMLHttpRequestResponseType
所以我想知道除了输入我的大部分论点any之外是否有任何解决方法。
【问题讨论】:
标签: reactjs typescript background-sync typescript-lib-dom