question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Config in Typescript with multiple files as source

See original GitHub issue

Hello,

Is there any way to generate the config.js file using a config.ts file as source where other files could be imported to allow better configuration organization (the .js file can become quite big) and to allow having it using the model type IConfig ?

I’m not sure if there is a clean way to do this now nor how to implement the changes that would be needed in order to have that.

Cheers in advance!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
richard-fairthornecommented, Jan 10, 2022

Just a final note:

to use multiple ts files, you will need to use a tool such as webpack, to combine all your sources into one — but because your config is it’s own separate project, you can use any tooling you choose.

1reaction
richard-fairthornecommented, Jan 10, 2022

Assuming I want to use RESTool from CDN, and load a ts configuration file. How do I do it?

Anyone who writes a TS config file will use the typescript compiler to turn it into a JS file. Then they will deploy the normal way.

The benefit of the change is that they can rely on the interfaces of restool from their own project, where they generate their config file.

Here’s the flow expressed as shell commands.

# create a project
mkdir my-config
cd my-config
npm init .

# include the libraries
npm i -D restool

# edit your config with full type support, autocomplete and intellisense hinting
code config.ts 

# generate a JavaScript config file from your typescript 
tsc config.ts
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I pass multiple source files to the TypeScript compiler?
Compile a project given a valid configuration file. The argument can be a file path to a valid JSON configuration file, or a...
Read more >
TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >
Can I configure TypeScript to compile multiple files into a ...
The easiest way is to make an index.ts and re-export everything you want to be importable by your users: export { Foo }...
Read more >
Compile TypeScript Project - TutorialsTeacher
As you know, TypeScript files can be compiled using the tsc <file name>.ts command. It will be tedious to compile multiple .ts files...
Read more >
Compiling Actions from multiple source files - Auth0 Community
I'm trying to implement my Actions in Typescript. In order to maximize both clarity and testability, I would like to be able to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found