gajus/roarr

[TS] Context types

davidskuza opened this issue · 1 comments

Hey, simple case, or as I thought.

https://codesandbox.io/s/sleepy-worker-s85bs

Simple interface for typed data, can't pass it to context. Is it how it's supposed to work?

gajus commented

Looks more like a TypeScript question. I am not sure why type works, but interface does not in this case.

This works:

import roarr from "roarr";

type Custom = {
  a: string;
  b: string;
}

const logger = roarr.Roarr;

const data: Custom = {
  a: "asd",
  b: "asd"
};

logger.error(
  {
    data
  },
  "test"
);