Skip to content
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

how to use a date-template with typescript #1

Open
SergProduction opened this issue Jun 29, 2022 · 0 comments
Open

how to use a date-template with typescript #1

SergProduction opened this issue Jun 29, 2022 · 0 comments

Comments

@SergProduction
Copy link
Owner

SergProduction commented Jun 29, 2022

  • create file type-overrides.d.ts in your src project
declare module 'date-template' {
  type Replaced = Record<string, { value: string | number; key: RegExp | string }>
  declare const template: (
    format: string,
    date: number | Date | string,
    middleware?: (replaced: Replaced) => Replaced
  ) => string
  export = template
}
{
  "compilerOptions": {
    "typeRoots": [
      "src/type-overrides.d.ts",
      "node_modules/@types"
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant