-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Strange "Cannot use namespace 'Foo' as a type" error with dummy declare module "foo";
declaration
#27311
Comments
It is technically correct from the perspective of how the compiler is implemented 🙃 In the specific case where we imported an
Open to bikeshedding |
Im having the same issue with trying to use create-react-app with typescript ver 3.2.1 and loona |
Same issue here, any help? |
This error was happening to me when I accidentally had I had to delete the |
@cmdcolin having your module declared is necessary when using typescript and having |
Edit: reading the OP more clearly, it makes more sense why this exists but I guess I just wanted to highlight that oftentimes this is in a separate declare.d.ts file so it's sort of hard to debug sometimes. |
welcome |
In my case, the errors were off when I renamed a React component file from |
In my case just removing |
create a tsconfig.json and "compilerOptions": { |
This did it for me! |
thanks! |
Maybe this is a question, but it has come up multiple times on Stack Overflow (most recently here) without a good answer, so I'm asking it here.
TypeScript Version: master (03af107)
Search Terms: "cannot use namespace" "as a type" TS2709 "declare module"
Code
Expected behavior: An error that makes sense, or no error?
Actual behavior:
error TS2709: Cannot use namespace 'Foo' as a type.
Playground Link: link
Related Issues: None found
The text was updated successfully, but these errors were encountered: