Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Add support for TypeScript files #116

@nunoleong

Description

@nunoleong

Currently, Dyson only loads routes from files with extension .js.
I'd like to express my route files as .ts, in TypeScript.

However, those files are not loaded.

I've traced to loader.js:8 where it calls

const rawConfigs = requireDir(module, path.resolve(configDir));

requireDir itself accepts an optional third parameter which is an object that allows defining which extensions to look for.

Changing it to
const rawConfigs = requireDir(module, path.resolve(configDir), {extensions: ['js','ts']});

Seems to have done the trick.

Is this something that could be somehow added to Dyson?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions