Giter Club home page Giter Club logo

Comments (4)

JulesGuesnon avatar JulesGuesnon commented on May 14, 2024 1

Hey!
After some investigation, it looks like the main use case of reading the tsconfig for type checking is only the module resolution (baseUrl is another example).
I don't know if it's the goal or not, but being able to run ezno against existing code base would be really nice, and without tsconfig I think it would be impossible.

Introducing it only for reading the compilerOptions.module would be nice imo. It's quite simple and straightforward to implement.
About the 2nd use case, Implementing Typescript alias system would be nice, but imo it would require to refactor the module resolution into another mod as it'll start to get bigger

from ezno.

kaleidawave avatar kaleidawave commented on May 14, 2024 1

Interesting. I had in plan to use oxc's resolver for files. I think it implements some of tsconfig parsing, so hopefully should have the same features of TSC.

For the moment I think adding checking for things like Promise and 'for loops' have priority before importing packages that use all those features, so will postpone this for now 👍

from ezno.

kaleidawave avatar kaleidawave commented on May 14, 2024

Interesting. This is one of the things I haven't looked at TSC's implementation. I should note Ezno does not currently read a tsconfig and doesn't have a lot of the same config.

The current relative importing logic looks at the path. If the path has an extension then it tries to read it directly. If it does not have an extension it looks for path.ts, then path.tsx and path.js until it gets a file

ezno/checker/src/lib.rs

Lines 299 to 312 in 0b5f688

let result = if full_importer.extension().is_some() {
get_module(full_importer.clone(), environment, self)
} else {
let mut result = None;
for ext in ["ts", "tsx", "js"] {
full_importer.set_extension(ext);
// TODO change parse options based on extension
result = get_module(full_importer.clone(), environment, self);
if result.is_some() {
break;
}
}
result
};

I haven't done a lot of investigation. Let me know if the current thing breaks or doesn't do quite the right thing under certain circumstances. If so maybe porting "module" from TypeScript's configuration might be needed?

from ezno.

JulesGuesnon avatar JulesGuesnon commented on May 14, 2024

Well imo this could be a good starting point to introduce reading the tsconfig. The module resolution is one use case, but another one would be to handle the aliases as for now it would break everything I think.
E.g:

"paths": {
    "@modules/*": ["src/modules/*"],
    "@services/*": ["src/services/*"]
}

from ezno.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.