-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Could you create @types for this module? #98
Comments
+1 for type definition files, and there are some useful links for you @harttle : http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html http://definitelytyped.org/guides/best-practices.html As the author of liquidjs, you can just add a file named like |
A |
Excellent!!! :) A few types are still missing: tagToken: any I also don't think 'void' is the right return type for render.. According to https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#rendering, render is supposed to return a string. Thanks to your types, I can finally implement tag using this kind of code: class HighlightTagImpl implements Liquid.Tag {
parse(tagToken: any, remainTokens: any): void {
throw new Error('Method not implemented.')
}
render(scope: any, hash: any): void {
throw new Error('Method not implemented.')
}
}
engine.registerTag('highlight', new HighlightTagImpl()) |
Update: the type definition is giving the following error. Here is how I import it in typescript: import Liquid, { LiquidEngine } from 'liquidjs' Here is how I use it in my typescript code: class MyClass {
private engine: LiquidEngine
public constructor() {
this.engine = Liquid()
}
} Here is the error I receive: TSError: ⨯ Unable to compile TypeScript: |
It turns that I MUST use |
Liquidjs is not a es module, so that you may HAVE to use the |
The demo is located at demo/typescript/index.ts , working on #98
## [6.4.3](v6.4.2...v6.4.3) (2019-02-13) ### Bug Fixes * better index.d.ts and a demo ([2015f68](2015f68)), closes [#98](#98)
Now it should work, there's an demo located at demo/typescript/index.ts. Definitions for tagToken, remainTokens, scope, hash, etc are still not available, but maybe added latter. Let me know if you have problems with the demo. |
Types seems broken in the latest 7.0 release? My ts project is complaining that could not find a declaration file for liquidjs. |
Now it's fixed @7.0.1 and all methods should be typed already. Closing. |
Could you create @types for this module so that it can be easily used in typescript?
The text was updated successfully, but these errors were encountered: