Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow

fix: Add Symbol.observable typings and isolate const enums (#141)

+5
.changeset/new-feet-sell.md
···
···
+
---
+
'wonka': patch
+
---
+
+
Fix missing `Symbol.observable` typings and remove `const enum` exports, which aren't usable in isolated modules.
+1 -1
package.json
···
"rollup-plugin-cjs-check": "^1.0.1",
"rollup-plugin-dts": "^5.1.1",
"tslib": "^2.4.1",
-
"typescript": "^4.9.3",
"vitest": "^0.25.3",
"zen-observable": "^0.10.0"
}
···
"rollup-plugin-cjs-check": "^1.0.1",
"rollup-plugin-dts": "^5.1.1",
"tslib": "^2.4.1",
+
"typescript": "^4.9.5",
"vitest": "^0.25.3",
"zen-observable": "^0.10.0"
}
+33 -33
pnpm-lock.yaml
···
rollup-plugin-cjs-check: ^1.0.1
rollup-plugin-dts: ^5.1.1
tslib: ^2.4.1
-
typescript: ^4.9.3
vitest: ^0.25.3
zen-observable: ^0.10.0
···
'@rollup/plugin-commonjs': 23.0.3_rollup@3.5.1
'@rollup/plugin-node-resolve': 15.0.1_rollup@3.5.1
'@rollup/plugin-terser': 0.1.0_rollup@3.5.1
-
'@rollup/plugin-typescript': 10.0.1_3d7bvrhnnvjmhphi3zgbz54owe
'@rollup/pluginutils': 5.0.2_rollup@3.5.1
'@types/zen-observable': 0.8.3
-
'@typescript-eslint/eslint-plugin': 5.45.0_yjegg5cyoezm3fzsmuszzhetym
-
'@typescript-eslint/parser': 5.45.0_s5ps7njkmjlaqajutnox5ntcla
callbag-from-iter: 1.3.0
callbag-iterate: 1.0.0
callbag-take: 1.5.0
···
rimraf: 3.0.2
rollup: 3.5.1
rollup-plugin-cjs-check: 1.0.1_rollup@3.5.1
-
rollup-plugin-dts: 5.1.1_rt6svyh24sgpogwv5hms77uhpq
tslib: 2.4.1
-
typescript: 4.9.3
vitest: 0.25.3
zen-observable: 0.10.0
···
terser: 5.16.1
dev: true
-
/@rollup/plugin-typescript/10.0.1_3d7bvrhnnvjmhphi3zgbz54owe:
resolution: {integrity: sha512-wBykxRLlX7EzL8BmUqMqk5zpx2onnmRMSw/l9M1sVfkJvdwfxogZQVNUM9gVMJbjRLDR5H6U0OMOrlDGmIV45A==}
engines: {node: '>=14.0.0'}
peerDependencies:
···
resolve: 1.22.1
rollup: 3.5.1
tslib: 2.4.1
-
typescript: 4.9.3
dev: true
/@rollup/pluginutils/5.0.2_rollup@3.5.1:
···
resolution: {integrity: sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw==}
dev: true
-
/@typescript-eslint/eslint-plugin/5.45.0_yjegg5cyoezm3fzsmuszzhetym:
resolution: {integrity: sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
typescript:
optional: true
dependencies:
-
'@typescript-eslint/parser': 5.45.0_s5ps7njkmjlaqajutnox5ntcla
'@typescript-eslint/scope-manager': 5.45.0
-
'@typescript-eslint/type-utils': 5.45.0_s5ps7njkmjlaqajutnox5ntcla
-
'@typescript-eslint/utils': 5.45.0_s5ps7njkmjlaqajutnox5ntcla
debug: 4.3.4
eslint: 8.29.0
ignore: 5.2.1
natural-compare-lite: 1.4.0
regexpp: 3.2.0
semver: 7.3.8
-
tsutils: 3.21.0_typescript@4.9.3
-
typescript: 4.9.3
transitivePeerDependencies:
- supports-color
dev: true
-
/@typescript-eslint/parser/5.45.0_s5ps7njkmjlaqajutnox5ntcla:
resolution: {integrity: sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
dependencies:
'@typescript-eslint/scope-manager': 5.45.0
'@typescript-eslint/types': 5.45.0
-
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.3
debug: 4.3.4
eslint: 8.29.0
-
typescript: 4.9.3
transitivePeerDependencies:
- supports-color
dev: true
···
'@typescript-eslint/visitor-keys': 5.45.0
dev: true
-
/@typescript-eslint/type-utils/5.45.0_s5ps7njkmjlaqajutnox5ntcla:
resolution: {integrity: sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
typescript:
optional: true
dependencies:
-
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.3
-
'@typescript-eslint/utils': 5.45.0_s5ps7njkmjlaqajutnox5ntcla
debug: 4.3.4
eslint: 8.29.0
-
tsutils: 3.21.0_typescript@4.9.3
-
typescript: 4.9.3
transitivePeerDependencies:
- supports-color
dev: true
···
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
-
/@typescript-eslint/typescript-estree/5.45.0_typescript@4.9.3:
resolution: {integrity: sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
globby: 11.1.0
is-glob: 4.0.3
semver: 7.3.8
-
tsutils: 3.21.0_typescript@4.9.3
-
typescript: 4.9.3
transitivePeerDependencies:
- supports-color
dev: true
-
/@typescript-eslint/utils/5.45.0_s5ps7njkmjlaqajutnox5ntcla:
resolution: {integrity: sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
'@types/semver': 7.3.13
'@typescript-eslint/scope-manager': 5.45.0
'@typescript-eslint/types': 5.45.0
-
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.3
eslint: 8.29.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.29.0
···
rollup: 3.5.1
dev: true
-
/rollup-plugin-dts/5.1.1_rt6svyh24sgpogwv5hms77uhpq:
resolution: {integrity: sha512-zpgo52XmnLg8w4k3MScinFHZK1+ro6r7uVe34fJ0Ee8AM45FvgvTuvfWWaRgIpA4pQ1BHJuu2ospncZhkcJVeA==}
engines: {node: '>=v14'}
peerDependencies:
···
dependencies:
magic-string: 0.27.0
rollup: 3.5.1
-
typescript: 4.9.3
optionalDependencies:
'@babel/code-frame': 7.18.6
dev: true
···
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
dev: true
-
/tsutils/3.21.0_typescript@4.9.3:
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
engines: {node: '>= 6'}
peerDependencies:
typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
dependencies:
tslib: 1.14.1
-
typescript: 4.9.3
dev: true
/tty-table/4.1.6:
···
hasBin: true
dev: true
-
/typescript/4.9.3:
-
resolution: {integrity: sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
···
rollup-plugin-cjs-check: ^1.0.1
rollup-plugin-dts: ^5.1.1
tslib: ^2.4.1
+
typescript: ^4.9.5
vitest: ^0.25.3
zen-observable: ^0.10.0
···
'@rollup/plugin-commonjs': 23.0.3_rollup@3.5.1
'@rollup/plugin-node-resolve': 15.0.1_rollup@3.5.1
'@rollup/plugin-terser': 0.1.0_rollup@3.5.1
+
'@rollup/plugin-typescript': 10.0.1_i353se4wjqegof6rzgogenttmu
'@rollup/pluginutils': 5.0.2_rollup@3.5.1
'@types/zen-observable': 0.8.3
+
'@typescript-eslint/eslint-plugin': 5.45.0_kmw7swegqdzhqtxnpydwp4nxvm
+
'@typescript-eslint/parser': 5.45.0_zbm6mgjew7sm4ssghrxdqoiad4
callbag-from-iter: 1.3.0
callbag-iterate: 1.0.0
callbag-take: 1.5.0
···
rimraf: 3.0.2
rollup: 3.5.1
rollup-plugin-cjs-check: 1.0.1_rollup@3.5.1
+
rollup-plugin-dts: 5.1.1_7qkzlat3umsxdjhtme2mo4o6km
tslib: 2.4.1
+
typescript: 4.9.5
vitest: 0.25.3
zen-observable: 0.10.0
···
terser: 5.16.1
dev: true
+
/@rollup/plugin-typescript/10.0.1_i353se4wjqegof6rzgogenttmu:
resolution: {integrity: sha512-wBykxRLlX7EzL8BmUqMqk5zpx2onnmRMSw/l9M1sVfkJvdwfxogZQVNUM9gVMJbjRLDR5H6U0OMOrlDGmIV45A==}
engines: {node: '>=14.0.0'}
peerDependencies:
···
resolve: 1.22.1
rollup: 3.5.1
tslib: 2.4.1
+
typescript: 4.9.5
dev: true
/@rollup/pluginutils/5.0.2_rollup@3.5.1:
···
resolution: {integrity: sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw==}
dev: true
+
/@typescript-eslint/eslint-plugin/5.45.0_kmw7swegqdzhqtxnpydwp4nxvm:
resolution: {integrity: sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
typescript:
optional: true
dependencies:
+
'@typescript-eslint/parser': 5.45.0_zbm6mgjew7sm4ssghrxdqoiad4
'@typescript-eslint/scope-manager': 5.45.0
+
'@typescript-eslint/type-utils': 5.45.0_zbm6mgjew7sm4ssghrxdqoiad4
+
'@typescript-eslint/utils': 5.45.0_zbm6mgjew7sm4ssghrxdqoiad4
debug: 4.3.4
eslint: 8.29.0
ignore: 5.2.1
natural-compare-lite: 1.4.0
regexpp: 3.2.0
semver: 7.3.8
+
tsutils: 3.21.0_typescript@4.9.5
+
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
+
/@typescript-eslint/parser/5.45.0_zbm6mgjew7sm4ssghrxdqoiad4:
resolution: {integrity: sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
dependencies:
'@typescript-eslint/scope-manager': 5.45.0
'@typescript-eslint/types': 5.45.0
+
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.5
debug: 4.3.4
eslint: 8.29.0
+
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
···
'@typescript-eslint/visitor-keys': 5.45.0
dev: true
+
/@typescript-eslint/type-utils/5.45.0_zbm6mgjew7sm4ssghrxdqoiad4:
resolution: {integrity: sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
typescript:
optional: true
dependencies:
+
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.5
+
'@typescript-eslint/utils': 5.45.0_zbm6mgjew7sm4ssghrxdqoiad4
debug: 4.3.4
eslint: 8.29.0
+
tsutils: 3.21.0_typescript@4.9.5
+
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
···
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
+
/@typescript-eslint/typescript-estree/5.45.0_typescript@4.9.5:
resolution: {integrity: sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
globby: 11.1.0
is-glob: 4.0.3
semver: 7.3.8
+
tsutils: 3.21.0_typescript@4.9.5
+
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
+
/@typescript-eslint/utils/5.45.0_zbm6mgjew7sm4ssghrxdqoiad4:
resolution: {integrity: sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
···
'@types/semver': 7.3.13
'@typescript-eslint/scope-manager': 5.45.0
'@typescript-eslint/types': 5.45.0
+
'@typescript-eslint/typescript-estree': 5.45.0_typescript@4.9.5
eslint: 8.29.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.29.0
···
rollup: 3.5.1
dev: true
+
/rollup-plugin-dts/5.1.1_7qkzlat3umsxdjhtme2mo4o6km:
resolution: {integrity: sha512-zpgo52XmnLg8w4k3MScinFHZK1+ro6r7uVe34fJ0Ee8AM45FvgvTuvfWWaRgIpA4pQ1BHJuu2ospncZhkcJVeA==}
engines: {node: '>=v14'}
peerDependencies:
···
dependencies:
magic-string: 0.27.0
rollup: 3.5.1
+
typescript: 4.9.5
optionalDependencies:
'@babel/code-frame': 7.18.6
dev: true
···
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
dev: true
+
/tsutils/3.21.0_typescript@4.9.5:
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
engines: {node: '>= 6'}
peerDependencies:
typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
dependencies:
tslib: 1.14.1
+
typescript: 4.9.5
dev: true
/tty-table/4.1.6:
···
hasBin: true
dev: true
+
/typescript/4.9.5:
+
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
+12 -1
src/index.ts
···
* @packageDocumentation
*/
-
export * from './types';
export * from './sources';
export * from './operators';
export * from './sinks';
···
* @packageDocumentation
*/
+
export type {
+
TeardownFn,
+
Signal,
+
Sink,
+
Source,
+
Operator,
+
TypeOfSource,
+
Subscription,
+
Observer,
+
Subject,
+
} from './types';
+
export * from './sources';
export * from './operators';
export * from './sinks';
+8 -1
src/observable.ts
···
import { Source, SignalKind, TalkbackKind } from './types';
import { push, start, talkbackPlaceholder } from './helpers';
/** A definition of the ES Observable Subscription type that is returned by
* {@link Observable.subscribe}
*
···
*
* @internal
*/
-
const observableSymbol = (): typeof Symbol.observable => Symbol.observable || '@@observable';
/** Converts an ES Observable to a {@link Source}.
* @param input - The {@link ObservableLike} object that will be converted.
···
import { Source, SignalKind, TalkbackKind } from './types';
import { push, start, talkbackPlaceholder } from './helpers';
+
declare global {
+
interface SymbolConstructor {
+
readonly observable: symbol;
+
}
+
}
+
/** A definition of the ES Observable Subscription type that is returned by
* {@link Observable.subscribe}
*
···
*
* @internal
*/
+
const observableSymbol = (): typeof Symbol.observable =>
+
Symbol.observable || ('@@observable' as any);
/** Converts an ES Observable to a {@link Source}.
* @param input - The {@link ObservableLike} object that will be converted.
+3 -1
tsconfig.json
···
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"noUnusedLocals": true,
···
"strict": true,
"noImplicitAny": false,
"noUnusedParameters": true,
-
"skipLibCheck": true
},
"include": ["src"]
}
···
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
+
"importsNotUsedAsValues": "remove",
"noEmit": true,
"esModuleInterop": true,
"noUnusedLocals": true,
···
"strict": true,
"noImplicitAny": false,
"noUnusedParameters": true,
+
"skipLibCheck": true,
+
"isolatedModules": true
},
"include": ["src"]
}