-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
DayJS import with typescript is failing (TS2349) #3572
Comments
I had the same issue and resolved it by modifying the typescript template file. I modified line 70 of File.liquid to the import that works for the application that is consuming my client. |
@MikeBecatti can you create a PR with a change to this file so it works out-of-the-box? |
@RicoSuter - Sorry but I should have added more information to my "solution". The change I recommended is really a work around for this issue rather than a true fix. Changing the import statement as the OP mentioned will cause compilation errors in other scenarios. I'll see if I can come up with a true solution. |
Alternative solution. Set this in nswag.json "importRequiredTypes": false, and create a file (nswag.import.ts) with types import like that import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, CancelToken } from 'axios';
import dayjs from 'dayjs' After this just add this propery in nswag.json "extensionCode": "nswag.import.ts", |
Hello team,
I've configure NSwag to generate date as DayJS, but typescript is not compiling with
* as dayjs
.This is the compilation failure that is happening:
This happens because the import is done like this
It works fine when the import statement is manually changed to:
Did I miss anything?
This is my
nswag.json
The text was updated successfully, but these errors were encountered: