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

Typescript Issue - Type expected issue on line 20 #1300

Closed
oswaldpope opened this issue Jan 3, 2021 · 8 comments · Fixed by #1302 or backstage/backstage#4967
Closed

Typescript Issue - Type expected issue on line 20 #1300

oswaldpope opened this issue Jan 3, 2021 · 8 comments · Fixed by #1302 or backstage/backstage#4967
Labels

Comments

@oswaldpope
Copy link

type UnitTypeLongPlural = `${UnitTypeLong}s`
.

node_modules/dayjs/index.d.ts:20:29 - error TS1110: Type expected.

tsc Version 3.9.5

issue from commit 676d09b#diff-093ad82a25aee498b11febf1cdcb6546e4d223ffcb49ed69cc275ac27ce0ccceR20

@iamkun
Copy link
Owner

iamkun commented Jan 3, 2021

Can you please provide a reproduction repo? tsc Version 3.9.5 tested fine on my side.

@navneetkaurbatth
Copy link

Me also having the same issue and getting this error during run time: TypeError: dayjs.extend is not a function

@ptz0n
Copy link

ptz0n commented Jan 3, 2021

Same issue as the initial report.

  • node@14.13.0
  • typescript@3.9.6
  • dayjs@1.10.0

tsconfig.json:

{
  "compilerOptions": {
    "sourceMap": false,
    "inlineSources": false,
    "inlineSourceMap": false,
    "noEmit": false,
    "declaration": true,
    "stripInternal": true,
    "outDir": "dist",
    "downlevelIteration": true,
    "esModuleInterop": true,
    "importHelpers": false,
    "module": "commonjs",
    "moduleResolution": "node",
    "noFallthroughCasesInSwitch": true,
    "removeComments": true,
    "target": "es6"
  },
  "include": [
    "src",
    "test"
  ]
}

test.ts:

import dayjs, { Dayjs } from "dayjs";

build:

$ tsc -p tsconfig.json 
node_modules/dayjs/index.d.ts:20:29 - error TS1110: Type expected.

20   type UnitTypeLongPlural = `${UnitTypeLong}s`
                               ~~~

Found 1 error.

@oswaldpope
Copy link
Author

oswaldpope commented Jan 3, 2021

Updating typescript to "typescript": "^4.1.3" fixed the issue. If you cannot upgrade then the problem still exists is the lower versions of typescript 3.9.5
node_modules/dayjs/index.d.ts:20:29 - error TS1110: Type expected.
20 type UnitTypeLongPlural = ${UnitTypeLong}s

@iamkun
Copy link
Owner

iamkun commented Jan 3, 2021

wiill fix soon

@iamkun iamkun mentioned this issue Jan 3, 2021
iamkun pushed a commit that referenced this issue Jan 3, 2021
## [1.10.1](v1.10.0...v1.10.1) (2021-01-03)

### Bug Fixes

* fix typescript type error UnitTypeLongPlural ([#1302](#1302)) ([bfaabe4](bfaabe4)), closes [#1300](#1300)
@iamkun
Copy link
Owner

iamkun commented Jan 3, 2021

🎉 This issue has been resolved in version 1.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamkun iamkun added the released label Jan 3, 2021
@pushred
Copy link

pushred commented Jan 4, 2021

I'm still experiencing an issue I think related to this where there is an Uncaught TypeError: dayjs.extend is not a function error at runtime:

  • Direct dependency: chrono-node@1.4.3
  • dayjs@1.10.1
  • TypeScript is not in use

I will probably need to fork chrono-node and pin the dayjs version in use to something earlier to resolve this as I'm not using Yarn in this particular project to be able to control resolutions

@pushred
Copy link

pushred commented Jan 5, 2021

I see the comment in #1281 (comment) indicating that version 1.10.0 unintentionally introduced an ESM-related breaking change and that 1.10.2 will reverse this. I'll fork chrono-node for the moment to pin to 1.9.8 and will see if 1.10.2 fixes the issue.

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.10.1](iamkun/dayjs@v1.10.0...v1.10.1) (2021-01-03)

### Bug Fixes

* fix typescript type error UnitTypeLongPlural ([#1302](iamkun/dayjs#1302)) ([bfaabe4](iamkun/dayjs@bfaabe4)), closes [#1300](iamkun/dayjs#1300)
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.10.1](iamkun/dayjs@v1.10.0...v1.10.1) (2021-01-03)

### Bug Fixes

* fix typescript type error UnitTypeLongPlural ([#1302](iamkun/dayjs#1302)) ([bfaabe4](iamkun/dayjs@bfaabe4)), closes [#1300](iamkun/dayjs#1300)
splashwizard pushed a commit to splashwizard/tracking-time that referenced this issue Oct 21, 2024
## [1.10.1](iamkun/dayjs@v1.10.0...v1.10.1) (2021-01-03)

### Bug Fixes

* fix typescript type error UnitTypeLongPlural ([#1302](iamkun/dayjs#1302)) ([bfaabe4](iamkun/dayjs@bfaabe4)), closes [#1300](iamkun/dayjs#1300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants