Closed michaelbromley closed 2 years ago
Ok, on further inspection I see that the logging is fully handled by the loglevel package, which is a direct dependency and also includes TS definitions. So I think it makes the most sense to directly expose the typings from that package in the config object, so as to not have to duplicate the typings inside the typesense-js code itself.
// Configuration.ts
import * as logger from 'loglevel'
import { Logger, LogLevelDesc } from 'loglevel'
// ...
export interface ConfigurationOptions {
// ...
logLevel?: LogLevelDesc
logger?: Logger
}
Does that seem like a reasonable solution?
@michaelbromley That sounds good to me. Thank you for helping with this.
Great, I'll put in a PR.
One question - should I include the updated built files in /lib & /dist with the PR? I'm guessing so but just want to make sure.
Could you skip the files in /lib and /dist in the PR, so the diff is easy to parse? I rebuild those before publishing to npm anyway.
I've pushed this out in 1.4.0-2
.
Description
In the
ConfigurationOptions
interface, there is alogger
property currently typed asany // todo
. It would be good to get this properly typed so it is possible to implement custom logging without needing to reverse-engineer the library.Metadata
Typsense Version: v1.3.0 (typesense-js)
OS: any
I'd like to have a go at adding typings for this.