Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Helper functions in TypeScript #39

Open
mesqueeb opened this issue Dec 18, 2019 · 6 comments
Open

Helper functions in TypeScript #39

mesqueeb opened this issue Dec 18, 2019 · 6 comments

Comments

@mesqueeb
Copy link
Contributor

I'm currently writing a bunch of Quasar UI components via regular Vue files.

I use functions from a separate helpers folder, which importing into my Vue components.

The helper files are all plain JavaScript files.

I would like to write these helper files in TypeScript. Is this possible?

@mesqueeb
Copy link
Contributor Author

mesqueeb commented May 3, 2020

so I'm trying to write all my helper files as .ts files in the quasar UI starter kit right,

I was able to set up Rollup to make sure it can build properly, and it works! 🎉

however, I cannot launch the dev server any more, because I get this error:

 ERROR  Failed to compile with 2 errors                                                                                                                                                           8:53:11 AM

 error  in /Users/lucaban/.ghq/github.com/mesqueeb/quasar-ui-easy-forms/ui/tsconfig.json

[tsl] ERROR
      TS6053: File '@quasar/app/tsconfig-preset' not found.

I followed this Quasar guide here, for the dev folder in the UI starter kit:

https://quasar.dev/quasar-cli/cli-documentation/supporting-ts

@mesqueeb
Copy link
Contributor Author

mesqueeb commented May 3, 2020

@IlCallo do you have any bandwidth to help me? 😇

@mesqueeb
Copy link
Contributor Author

mesqueeb commented May 3, 2020

changed the tsconfig.json contents to point to this:
"node_modules/@quasar/app/tsconfig-preset.json",

but then I have this error:

[tsl] ERROR
      TS18002: The 'files' list in config file 'tsconfig.json' is empty.

 error  in ../src/helpers/validation.ts

Module build failed (from ./node_modules/ts-loader/index.js):
  Error: error while parsing tsconfig.json
{
  "extends": "node_modules/@quasar/app/tsconfig-preset.json",
  "compilerOptions": {
    "baseUrl": "."
  }
}

@mesqueeb
Copy link
Contributor Author

mesqueeb commented May 3, 2020

Also some Vue related errors I believe:
image

@mesqueeb
Copy link
Contributor Author

mesqueeb commented May 3, 2020

I fixed the other issues by tweaking the tsconfig.ts.

But am still stuck here:

image

This is the repo (vue+typescript-helpers branch), to replicate:

cd ui
npm i
npm run dev

https://github.com/mesqueeb/quasar-ui-easy-forms/tree/vue+typescript-helpers

@IlCallo
Copy link
Member

IlCallo commented May 3, 2020

Hey there, really strange it doesn't pick up the preset automatically from Quasar app dependency. Check there isn't some kind of dependency conflict.
Also, I'm not sure it can pick it up with relative path if it doesn't start with ./..., and that could be the cause of the strange error you got (never seen it)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants