Having trouble with `@effect/cli`
...
const ohlcvCommand = Command.make(
'ohlcv',
{
exchange: Args.choice(Object.entries(ccxt.exchanges), {
name: 'exchangeId',
}),
symbol: Args.text({ name: 'exchangeSymbol' }),
timeframe: Args.text({ name: 'timeframe' }),
start: Args.date({ name: 'start' }),
end: Args.date({ name: 'end' }),
},
(args) => {
const exchangeId: ExchangeId = args.exchange as ExchangeId
const symbol: ExchangeSymbol = args.symbol
const timeframe: Timeframe = args.timeframe
const start = args.start
const end = args.end
return Effect.gen(function* () {
const crypto = yield* CryptoDataService
const result = yield* crypto.getOHLCV(
exchangeId,
symbol,
timeframe,
start,
end,
)
console.log('result', result)
})
},
)...
const ohlcvCommand = Command.make(
'ohlcv',
{
exchange: Args.choice(Object.entries(ccxt.exchanges), {
name: 'exchangeId',
}),
symbol: Args.text({ name: 'exchangeSymbol' }),
timeframe: Args.text({ name: 'timeframe' }),
start: Args.date({ name: 'start' }),
end: Args.date({ name: 'end' }),
},
(args) => {
const exchangeId: ExchangeId = args.exchange as ExchangeId
const symbol: ExchangeSymbol = args.symbol
const timeframe: Timeframe = args.timeframe
const start = args.start
const end = args.end
return Effect.gen(function* () {
const crypto = yield* CryptoDataService
const result = yield* crypto.getOHLCV(
exchangeId,
symbol,
timeframe,
start,
end,
)
console.log('result', result)
})
},
)Gives me this error:
Argument of type '(args: { readonly exchange: string; readonly symbol: string; readonly timeframe: string; readonly start: Date; readonly end: Date; }) => Effect<void, UnsupportedExchangeError, CryptoDataServiceType>' is not assignable to parameter of type '(_: { readonly exchange: string; readonly symbol: string; readonly timeframe: string; readonly start: Date; readonly end: Date; }) => Effect<void, unknown, unknown>'.
Type 'Effect<void, UnsupportedExchangeError, CryptoDataServiceType>' is missing the following properties from type 'Effect<void, unknown, unknown>': [EffectTypeId], [SinkTypeId], [StreamTypeId], [ChannelTypeId]ts(2345)Argument of type '(args: { readonly exchange: string; readonly symbol: string; readonly timeframe: string; readonly start: Date; readonly end: Date; }) => Effect<void, UnsupportedExchangeError, CryptoDataServiceType>' is not assignable to parameter of type '(_: { readonly exchange: string; readonly symbol: string; readonly timeframe: string; readonly start: Date; readonly end: Date; }) => Effect<void, unknown, unknown>'.
Type 'Effect<void, UnsupportedExchangeError, CryptoDataServiceType>' is missing the following properties from type 'Effect<void, unknown, unknown>': [EffectTypeId], [SinkTypeId], [StreamTypeId], [ChannelTypeId]ts(2345)I'm starting to learn to use effect services and layers but I don't understand why this
Command.makeCommand.make wants a function that returns Effect<void, unknown, unknown>Effect<void, unknown, unknown>.