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
ἔρως
ἔρως10mo ago
what? what do you mean "file that doesn't exist?" also, why are you using jsdoc for typescript?
abdelrahman
abdelrahmanOP10mo ago
it was a try
ἔρως
ἔρως10mo ago
what are you trying to do?
abdelrahman
abdelrahmanOP10mo ago
i have a component a my pkg accessing wathqny.config that file not is not there but it is one the site
ἔρως
ἔρως10mo ago
.config isn't a valid extension
abdelrahman
abdelrahmanOP10mo ago
it is a ts file you don't have to add the type ex in js/ts
ἔρως
ἔρως10mo ago
you're trying to load a file called "wathqny.config.ts"?
abdelrahman
abdelrahmanOP10mo ago
i am using that file already but i have jsut type problem
ἔρως
ἔρως10mo ago
so, whats the problem? which type problem?
abdelrahman
abdelrahmanOP10mo ago
i want to load the type for a file that dosen't exits import type { WathqnyConfig as WathqnyConfigType } from "wtqtypes";
ἔρως
ἔρως10mo ago
show us the problem show us error messages, compilation errors ... something
abdelrahman
abdelrahmanOP10mo ago
No description
ἔρως
ἔρως10mo ago
you have to create the file then also, why are you importing types manually? wouldnt a .d.ts file be enough?
abdelrahman
abdelrahmanOP10mo ago
because the file is not there the types is my own types
ἔρως
ἔρως10mo ago
what do those files have?
dys 🐙
dys 🐙10mo 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
abdelrahmanOP10mo 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
ἔρως
ἔρως10mo ago
what even are you trying to do?
abdelrahman
abdelrahmanOP10mo 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
ἔρως
ἔρως10mo 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
abdelrahmanOP10mo ago
the WathqnyConfigType already comes from .d.ts
ἔρως
ἔρως10mo ago
so, you're importing the .d.ts file?
Want results from more Discord servers?
Add your server