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
Typescript Intellisense #19
Comments
|
You'll have to write a declaration file, something like this: declare module 'param.macro' {
export const _: any
export const it: (...args: any[]) => any
export const lift: (expr: any) => (...args: any[]) => any
}I don't imagine this would be useful for type info but maybe for usability purposes it's ok. |
|
Feel free to discuss but I'm going to close since this is currently outside the scope of the project. |
|
Hi @citycide I still don't understand how should we use this with Typescript. I tried this: const item = {id: 2}
const arr = [{id: 1}, {id: 2}]
const ndx = arr.findIndex(it.id === item.id);gives me an error of: Do I miss something here ? |
|
@ghalex it's highly unlikely there's any typing you'll be able to do that will give you the full range of features, unfortunately. We'll need TypeScript compiler extensions most likely and there's nothing official for that right now. The problem in your case is that I'm happy to accept changes here that make TypeScript support possible but I don't think it'll be easy. |
|
@haltcase That's very unfortunate to hear, I hope the situation will improve eventually. The world is moving to typescript (BTW kotlin js now generate d.ts files !) |
|
@LifeIsStrange I agree, I have also personally switched to TypeScript for many projects and miss I'm fairly certain a compiler plugin would be capable of this, but as far as I know this currently requires a separate wrapper around the compiler to enable their use in most cases, see ttypescript. I've considered doing this but have not explored the compiler API enough. |
|
Wait...Are you talking about using param.macro in the TS project? AFAIK macro works well in the TS, as long as you are using babel + ts , see https://github.com/linonetwo/template-based-generator-template/blob/master/src/data/index.ts for an example! |
Is it possible to add typing so
itreflects it is a function parameter?The text was updated successfully, but these errors were encountered: