0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

`dist/wonka.d.ts` failing typecheck on TS 4.9.3+ #140

Closed airhorns closed 1 year ago

airhorns commented 1 year ago

CI is failing for a package I maintain that uses wonka via urql, and typechecks with skipLibCheck: false and isolatedModules: true. I am now getting the following errors after the release of 6.2.0 and 6.2.1:

claw ~/C/scratch-winka ➜  npx tsc
../node_modules/wonka/dist/wonka.d.ts:1296:5 - error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.

1296     [Symbol.observable]?(): Observable<T>;
         ~~~~~~~~~~~~~~~~~~~

../node_modules/wonka/dist/wonka.d.ts:1296:13 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.

1296     [Symbol.observable]?(): Observable<T>;
                 ~~~~~~~~~~

../node_modules/wonka/dist/wonka.d.ts:1325:5 - error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.

1325     [Symbol.observable](): Observable<T>;
         ~~~~~~~~~~~~~~~~~~~

../node_modules/wonka/dist/wonka.d.ts:1325:13 - error TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.

1325     [Symbol.observable](): Observable<T>;
                 ~~~~~~~~~~

../node_modules/wonka/dist/wonka.d.ts:1428:44 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.

1428 export { Observer, Operator, Push, Signal, SignalKind, Sink, Source, Start, Subject, Subscription, Tag, TalkbackFn, TalkbackKind, TeardownFn, TypeOfSource, buffer, combine, concat, concatAll, concatMap, debounce, delay, empty, filter, mergeAll as flatten, forEach, fromArray, fromAsyncIterable, fromCallbag, fromDomEvent, fromIterable, fromObservable, fromPromise, fromValue, interval, lazy, make, makeSubject, map, merge, mergeAll, mergeMap, never, onEnd, onPush, onStart, pipe, publish, sample, scan, share, skip, skipUntil, skipWhile, subscribe, switchAll, switchMap, take, takeLast, takeUntil, takeWhile, onPush as tap, throttle, toArray, toAsyncIterable, toCallbag, toObservable, toPromise, zip };
                                                ~~~~~~~~~~

../node_modules/wonka/dist/wonka.d.ts:1428:117 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.

1428 export { Observer, Operator, Push, Signal, SignalKind, Sink, Source, Start, Subject, Subscription, Tag, TalkbackFn, TalkbackKind, TeardownFn, TypeOfSource, buffer, combine, concat, concatAll, concatMap, debounce, delay, empty, filter, mergeAll as flatten, forEach, fromArray, fromAsyncIterable, fromCallbag, fromDomEvent, fromIterable, fromObservable, fromPromise, fromValue, interval, lazy, make, makeSubject, map, merge, mergeAll, mergeMap, never, onEnd, onPush, onStart, pipe, publish, sample, scan, share, skip, skipUntil, skipWhile, subscribe, switchAll, switchMap, take, takeLast, takeUntil, takeWhile, onPush as tap, throttle, toArray, toAsyncIterable, toCallbag, toObservable, toPromise, zip };
                                                                                                                         ~~~~~~~~~~~~

Found 6 errors in the same file, starting at: ../node_modules/wonka/dist/wonka.d.ts:1296

To reproduce, in a new folder:

npm install wonka typescript

Add the following to tsconfig.json:

{
  "compilerOptions": {
    "lib": ["dom", "ES2018"],
    "target": "es2016",                                  
    "module": "commonjs",                                
    "esModuleInterop": true,                             
    "forceConsistentCasingInFileNames": true,            
    "strict": true,                                      
    "skipLibCheck": false,
    "isolatedModules": true,                                 
  }
}

Add the following to index.ts:

import wonka from "wonka";

And then run npx tsc --noEmit.

kitten commented 1 year ago

Sorry for the trouble. This should be resolved in v6.2.2 :v:

airhorns commented 1 year ago

Thanks for the speedy resolution 💖