how i can add type to file that doesn't not exits

import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";

/** @type {import('wtqtypes').WathqnyConfig} */
import WathqnyConfig from "/wathqny.config";
import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";

/** @type {import('wtqtypes').WathqnyConfig} */
import WathqnyConfig from "/wathqny.config";
how i can add type to file that doesn't not exits
22 Replies
ἔρως
ἔρως9mo ago
what? what do you mean "file that doesn't exist?" also, why are you using jsdoc for typescript?
abdelrahman
abdelrahmanOP9mo ago
it was a try
ἔρως
ἔρως9mo ago
what are you trying to do?
abdelrahman
abdelrahmanOP9mo ago
i have a component a my pkg accessing wathqny.config that file not is not there but it is one the site
ἔρως
ἔρως9mo ago
.config isn't a valid extension
abdelrahman
abdelrahmanOP9mo ago
it is a ts file you don't have to add the type ex in js/ts
ἔρως
ἔρως9mo ago
you're trying to load a file called "wathqny.config.ts"?
abdelrahman
abdelrahmanOP9mo ago
i am using that file already but i have jsut type problem
ἔρως
ἔρως9mo ago
so, whats the problem? which type problem?
abdelrahman
abdelrahmanOP9mo ago
i want to load the type for a file that dosen't exits import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";
ἔρως
ἔρως9mo ago
show us the problem show us error messages, compilation errors ... something
abdelrahman
abdelrahmanOP9mo ago
No description
ἔρως
ἔρως9mo ago
you have to create the file then also, why are you importing types manually? wouldnt a .d.ts file be enough?
abdelrahman
abdelrahmanOP9mo ago
because the file is not there the types is my own types
ἔρως
ἔρως9mo ago
what do those files have?
dys 🐙
dys 🐙9mo ago
That leading / on /wathqny.config will cause it to look in the root of the filesystem. If you want the current directory, use ./.
abdelrahman
abdelrahmanOP9mo ago
import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";

// @ts-ignore
import untypedWathqnyConfig from "/wathqny.config";

const WathqnyConfig: WathqnyConfigType = untypedWathqnyConfig;
import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";

// @ts-ignore
import untypedWathqnyConfig from "/wathqny.config";

const WathqnyConfig: WathqnyConfigType = untypedWathqnyConfig;
this is the solution
ἔρως
ἔρως9mo ago
what even are you trying to do?
abdelrahman
abdelrahmanOP9mo ago
i was trying to get a types for my component that i am using it in my site where wathqny.config because of that file doesn't not exits for the typescript lang server but for compile it works
ἔρως
ἔρως9mo ago
how about you create a .d.ts file with the types you need? for example, your "untyped" file could have a .d.ts counterpart that describes the data types
abdelrahman
abdelrahmanOP9mo ago
the WathqnyConfigType already comes from .d.ts
ἔρως
ἔρως9mo ago
so, you're importing the .d.ts file?
Want results from more Discord servers?
Add your server