- #783 — 💥 BREAKING: Convert ShareDB to TypeScript
- Huge thanks to @ericyhwang, who did the majority of this work in #707, including the codemods that converted the codebase!
lib/is now compiled fromsrc/withtsc, and still targets ES5. It behaves differently to 8.0.0 in these ways:- It runs in strict mode, so mutating a frozen object a caller passed in (eg
Queryoptions) now throws - Subclass prototypes get an enumerable
constructor, so egnew MemoryDB().constructoris nowMemoryDBrather thanDB - Internal modules like
lib/typesgain__esModule, so bundlers andesModuleInteropresolve a default import of one (egimport types from 'sharedb/lib/types') toundefined. Use a namespace import instead:import * as types from 'sharedb/lib/types' emitter.EventEmitterbecomes a read-only re-export
- It runs in strict mode, so mutating a frozen object a caller passed in (eg
- This beta doesn't ship type declarations yet, so keep using
@types/sharedbfor now