-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR in node_modules/dayjs/index.d.ts(99,30): error TS2304: Cannot find name 'unknown'. node_modules/dayjs/index.d.ts(101,30): error TS2304: Cannot find name 'unknown'. #928
Comments
Can you test this in a pure typescript project and check if the ts config is correct. |
Hi iamkun, |
@abhiram90 The You'll probably need to update your typescript to latest. I also had problems with @types/node, but only updating it to latest worked as well! I hope that fixes your issue too! |
@iamkun what do you think about adding some information in the readme that |
Sounds sweet! |
Hi, import * as dayjs from "dayjs";
import * as relativeTime from "dayjs/plugin/relativeTime";
dayjs.extend(relativeTime); It gives me this warning:
|
@padunk a reproduction demo please |
@iamkun here is the link with vanilla TS in codesandbox |
@padunk According to your 'tsconfig', this should work fine.
Ref: https://day.js.org/docs/en/installation/typescript#have-trouble-importing-dayjs |
@iamkun , sorry I just copy paste from the docs. import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
dayjs.extend(relativeTime); This work fine. |
A temp fix could be
or to be more exact if you want:
ref: getsentry/sentry-javascript#2322 (comment) PS: We could replace this 'unknown' with some other syntax to make it work under typescript 3. |
Describe the bug
Used dayjs in angular component as below. Got error when buildng the application.
import * as dayjs from 'dayjs';
import * as utc from 'dayjs/plugin/utc';
dayjs.extend(utc);
component{
var x = dayjs.utc(initialDate).format('YYYY-MM-DD');
}
Information
The text was updated successfully, but these errors were encountered: