Skip to content
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

type checking civet file with ext other than .civet doesn't work #1508

Open
johndeighan opened this issue Oct 24, 2024 · 1 comment
Open

Comments

@johndeighan
Copy link

I'm working on developing a variant of civet syntax, so I give my files extensions which are not '.civet'. However, when I try to use the --typecheck option and provide the actual file name, I get an error which I think is because the file extension is not '.civet'. E.g., consider the following file:

let x: string = 42

Let's say I create 2 different files with these same contents, and name them test.civet and test.other. Here is the result of executing civet --typecheck test.civet

$ civet --typecheck test.civet
test.civet.tsx:1:5 - error TS2322: Type 'number' is not assignable to type 'string'.

1 let x: string = 42
      ~

which is what I expect. However, when I execute civet --typecheck test.other, I get:

$ civet --typecheck test.other
TypeError: Cannot read properties of null (reading 'code')
    at cli (C:\Users\johnd\llutils\node_modules\@danielx\civet\dist\civet:562:32)

@edemaine
Copy link
Collaborator

I agree that the CLI shouldn't error like this, but I'm not sure what the behavior should be. I think it's reasonable to expect civet --typecheck to work with both .civet files and .ts/.js files (which just get passed onto TypeScript). How is it supposed to know what to do with .other files?

To understand your context: Are you transpiling from .other to .civet? If so, why not use civet --typecheck on the resulting .civet files? Or are modifying Civet itself to support .other? If so, why not modify the CLI accordingly? I think I'm missing the intended application where other extensions make sense with the Civet CLI.

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

No branches or pull requests

2 participants