diff --git a/packages/store/addon/-private/ts-interfaces/utils/brand.ts b/packages/store/addon/-private/ts-interfaces/utils/brand.ts index bec27cc574d..bfd626a8909 100644 --- a/packages/store/addon/-private/ts-interfaces/utils/brand.ts +++ b/packages/store/addon/-private/ts-interfaces/utils/brand.ts @@ -1,3 +1,5 @@ +import { symbol } from './symbol'; + /** @module @ember-data/store */ @@ -14,4 +16,5 @@ * * @internal */ -export const BRAND_SYMBOL = Symbol(`DEBUG-ts-brand`); + +export const BRAND_SYMBOL: unique symbol = symbol('DEBUG-ts-brand'); diff --git a/packages/store/addon/-private/ts-interfaces/utils/symbol.ts b/packages/store/addon/-private/ts-interfaces/utils/symbol.ts new file mode 100644 index 00000000000..ae8b0acb448 --- /dev/null +++ b/packages/store/addon/-private/ts-interfaces/utils/symbol.ts @@ -0,0 +1,19 @@ +/** + @module @ember-data/store +*/ + +/** + * This symbol provides a Symbol replacement for browsers that do not have it + * (eg. IE 11). + * + * The replacement is different from the native Symbol in some ways. It is a + * function that produces an output: + * - iterable; + * - that is a string, not a symbol. + * + * @internal + */ +export const symbol = + typeof Symbol !== 'undefined' + ? Symbol + : (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any;