-
Notifications
You must be signed in to change notification settings - Fork 65
feat: add typescript type declarations for all packages #649
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
Open
salama968
wants to merge
2
commits into
accordproject:main
Choose a base branch
from
salama968:salama968/i648/add-typescript-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "allowJs": true, | ||
| "declaration": true, | ||
| "emitDeclarationOnly": true, | ||
| "outDir": "types", | ||
| "strict": false | ||
| }, | ||
| "include": ["index.js", "lib/**/*.js"] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export const CiceroMarkTransformer: typeof import("./lib/CiceroMarkTransformer"); | ||
| export const FromCiceroEditVisitor: typeof import("./lib/FromCiceroEditVisitor"); | ||
| export const ToCommonMarkVisitor: typeof import("./lib/ToCommonMarkVisitor"); | ||
| export const Decorators: typeof import("./lib/Decorators"); |
1 change: 1 addition & 0 deletions
1
packages/markdown-cicero/types/lib/CiceroEditTransformer.test.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export {}; |
107 changes: 107 additions & 0 deletions
107
packages/markdown-cicero/types/lib/CiceroMarkTransformer.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| export = CiceroMarkTransformer; | ||
| /** | ||
| * Converts a CiceroMark DOM to/from a | ||
| * CommonMark DOM. | ||
| * | ||
| * Converts a CiceroMark DOM to/from a markdown string. | ||
| */ | ||
| declare class CiceroMarkTransformer { | ||
| commonMark: import("@accordproject/markdown-common/types/lib/CommonMarkTransformer"); | ||
| modelManager: ModelManager; | ||
| serializer: Serializer; | ||
| /** | ||
| * Obtain the Clause text for a Clause node | ||
| * @param {*} input CiceroMark DOM | ||
| * @returns {*} markdown_cicero string | ||
| */ | ||
| getClauseText(input: any): any; | ||
| /** | ||
| * Retrieve the serializer used by the parser | ||
| * | ||
| * @returns {*} a serializer capable of dealing with the Concerto | ||
| * object returns by parse | ||
| */ | ||
| getSerializer(): any; | ||
| /** | ||
| * Converts a CiceroEdit string to a CiceroMark DOM | ||
| * @param {*} input - ciceroedit string | ||
| * @returns {*} CiceroMark DOM | ||
| */ | ||
| fromCiceroEdit(input: any): any; | ||
| /** | ||
| * Converts a CiceroMark DOM to a CiceroMark Unwrapped DOM | ||
| * @param {object} input - CiceroMark DOM (JSON) | ||
| * @param {object} [options] configuration options | ||
| * @param {boolean} [options.unquoteVariables] if true variable quotations are removed | ||
| * @returns {*} CiceroMark DOM | ||
| */ | ||
| toCiceroMarkUnwrapped(input: object, options?: { | ||
| unquoteVariables?: boolean; | ||
| }): any; | ||
| /** | ||
| * Converts a CommonMark DOM to a CiceroMark DOM | ||
| * @param {*} input - CommonMark DOM (in JSON) | ||
| * @returns {*} CiceroMark DOM | ||
| */ | ||
| fromCommonMark(input: any): any; | ||
| /** | ||
| * Converts a markdown string to a CiceroMark DOM | ||
| * @param {string} markdown a markdown string | ||
| * @returns {object} ciceromark object (JSON) | ||
| */ | ||
| fromMarkdown(markdown: string): object; | ||
| /** | ||
| * Converts a CiceroMark DOM to a markdown string | ||
| * @param {*} input CiceroMark DOM | ||
| * @param {object} [options] configuration options | ||
| * @returns {*} markdown string | ||
| */ | ||
| toMarkdown(input: any, options?: object): any; | ||
| /** | ||
| * Converts a cicero markdown string to a CiceroMark DOM | ||
| * @param {string} markdown a cicero markdown string | ||
| * @param {object} [options] configuration options | ||
| * @returns {object} ciceromark object (JSON) | ||
| */ | ||
| fromMarkdownCicero(markdown: string, options?: object): object; | ||
| /** | ||
| * Converts a CiceroMark DOM to a cicero markdown string | ||
| * @param {object} input CiceroMark DOM | ||
| * @returns {string} json commonmark object | ||
| */ | ||
| toMarkdownCicero(input: object): string; | ||
| /** | ||
| * Converts a CiceroMark DOM to a CommonMark DOM | ||
| * @param {*} input CiceroMark DOM | ||
| * @param {object} [options] configuration options | ||
| * @param {boolean} [options.removeFormatting] if true the formatting nodes are removed | ||
| * @param {boolean} [options.unquoteVariables] if true variable quotations are removed | ||
| * @returns {*} json commonmark object | ||
| */ | ||
| toCommonMark(input: any, options?: { | ||
| removeFormatting?: boolean; | ||
| unquoteVariables?: boolean; | ||
| }): any; | ||
| /** | ||
| * Unquotes a CiceroMark DOM | ||
| * @param {object} input CiceroMark DOM | ||
| * @returns {object} unquoted CiceroMark DOM | ||
| */ | ||
| unquote(input: object): object; | ||
| /** | ||
| * Converts a ciceromark string into a token stream | ||
| * | ||
| * @param {string} input the string to parse | ||
| * @returns {*} a markdown-it token stream | ||
| */ | ||
| toTokens(input: string): any; | ||
| /** | ||
| * Converts a token stream into a CiceroMark DOM object. | ||
| * | ||
| * @param {object} tokenStream the token stream | ||
| * @returns {*} the CiceroMark DOM (JSON) | ||
| */ | ||
| fromTokens(tokenStream: object): any; | ||
| } | ||
| import { ModelManager } from "@accordproject/concerto-core"; | ||
| import { Serializer } from "@accordproject/concerto-core"; |
1 change: 1 addition & 0 deletions
1
packages/markdown-cicero/types/lib/CiceroMarkTransformer.test.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| export = Decorators; | ||
| /** | ||
| * A class to retrieve decorators on CiceroMark nodes | ||
| */ | ||
| declare class Decorators { | ||
| /** | ||
| * Construct an instance, based on a CiceroMark node | ||
| * Note that decorator arguments must be specified as an | ||
| * array of [name (string),value] pairs, even though this is | ||
| * not enforced by the Concerto grammar. | ||
| * @param {object} node the CiceroMark node | ||
| */ | ||
| constructor(node: object); | ||
| data: {}; | ||
| /** | ||
| * Returns true is the decorator is present | ||
| * @param {string} decoratorName the name of the decorator | ||
| * @returns {boolean} true is the decorator is present | ||
| */ | ||
| hasDecorator(decoratorName: string): boolean; | ||
| /** | ||
| * Get the arguments for a named decorator | ||
| * @param {string} decoratorName the name of the decorator | ||
| * @returns {array} an array of arguments, or null | ||
| */ | ||
| getArguments(decoratorName: string): any[]; | ||
| /** | ||
| * Get the arguments for a named decorator | ||
| * @param {string} decoratorName the name of the decorator | ||
| * @param {string} argumentName the name of the decorator argument | ||
| * @returns {object} the value of the argument or null if the decorator | ||
| * is missing or undefined if the argument is missing | ||
| */ | ||
| getDecoratorValue(decoratorName: string, argumentName: string): object; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export {}; |
33 changes: 33 additions & 0 deletions
33
packages/markdown-cicero/types/lib/FromCiceroEditVisitor.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| export = FromCiceroEditVisitor; | ||
| /** | ||
| * Converts a CommonMark DOM to a CiceroMark DOM | ||
| */ | ||
| declare class FromCiceroEditVisitor { | ||
| /** | ||
| * Visits a sub-tree and return CiceroMark DOM | ||
| * @param {*} visitor the visitor to use | ||
| * @param {*} thing the node to visit | ||
| * @param {*} [parameters] optional parameters | ||
| */ | ||
| static visitChildren(visitor: any, thing: any, parameters?: any): void; | ||
| /** | ||
| * Visits a list of nodes and return the CiceroMark DOM | ||
| * @param {*} visitor the visitor to use | ||
| * @param {*} things the list node to visit | ||
| * @param {*} [parameters] optional parameters | ||
| */ | ||
| static visitNodes(visitor: any, things: any, parameters?: any): void; | ||
| /** | ||
| * Find an attribute from its name | ||
| * @param {*} attributes - the array of attributes | ||
| * @param {string} name - the name of the attributes | ||
| * @return {*} the attribute or undefined | ||
| */ | ||
| static getAttribute(attributes: any, name: string): any; | ||
| /** | ||
| * Visit a node | ||
| * @param {*} thing the object being visited | ||
| * @param {*} parameters the parameters | ||
| */ | ||
| visit(thing: any, parameters: any): void; | ||
| } |
20 changes: 20 additions & 0 deletions
20
packages/markdown-cicero/types/lib/ToCiceroMarkUnwrappedVisitor.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export = ToCiceroMarkUnwrappedVisitor; | ||
| /** | ||
| * Converts a CiceroMark DOM to a CiceroMark unwrapped DOM | ||
| */ | ||
| declare class ToCiceroMarkUnwrappedVisitor { | ||
| /** | ||
| * Visits a sub-tree and return the CommonMark DOM | ||
| * @param {*} visitor the visitor to use | ||
| * @param {*} thing the node to visit | ||
| * @param {*} [parameters] optional parameters | ||
| */ | ||
| static visitChildren(visitor: any, thing: any, parameters?: any): void; | ||
| /** | ||
| * Visit a node | ||
| * @param {*} thing the object being visited | ||
| * @param {*} parameters the parameters | ||
| * @return {*[]} result nodes | ||
| */ | ||
| visit(thing: any, parameters: any): any[]; | ||
| } |
20 changes: 20 additions & 0 deletions
20
packages/markdown-cicero/types/lib/ToCommonMarkVisitor.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export = ToCommonMarkVisitor; | ||
| /** | ||
| * Converts a CiceroMark DOM to a CommonMark DOM | ||
| */ | ||
| declare class ToCommonMarkVisitor { | ||
| /** | ||
| * Visits a sub-tree and return the CommonMark DOM | ||
| * @param {*} visitor the visitor to use | ||
| * @param {*} thing the node to visit | ||
| * @param {*} [parameters] optional parameters | ||
| */ | ||
| static visitChildren(visitor: any, thing: any, parameters?: any): void; | ||
| /** | ||
| * Visit a node | ||
| * @param {*} thing the object being visited | ||
| * @param {*} parameters the parameters | ||
| * @return {*[]} result nodes | ||
| */ | ||
| visit(thing: any, parameters: any): any[]; | ||
| } |
20 changes: 20 additions & 0 deletions
20
packages/markdown-cicero/types/lib/ToMarkdownCiceroVisitor.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export = ToMarkdownCiceroVisitor; | ||
| declare const ToMarkdownCiceroVisitor_base: typeof import("@accordproject/markdown-common/types/lib/FromCommonMarkVisitor"); | ||
| /** | ||
| * Converts a CiceroMark DOM to a cicero markdown string. | ||
| */ | ||
| declare class ToMarkdownCiceroVisitor extends ToMarkdownCiceroVisitor_base { | ||
| /** | ||
| * Construct the visitor. | ||
| * @param {object} [options] configuration options | ||
| * @param {*} resultSeq how to sequentially combine results | ||
| * @param {object} rules how to process each node type | ||
| */ | ||
| constructor(options?: object); | ||
| /** | ||
| * Converts a CiceroMark DOM to a cicero markdown string. | ||
| * @param {*} input - CiceroMark DOM (JSON) | ||
| * @returns {string} the cicero markdown string | ||
| */ | ||
| toMarkdownCicero(input: any): string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export = unquoteVariables; | ||
| /** | ||
| * Replaces variable and formulas with text nodes | ||
| * @param {*} input input object | ||
| * @param {*} options options object | ||
| * @returns {*} the modified object | ||
| */ | ||
| declare function unquoteVariables(input: any): any; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| declare namespace formulaRule { | ||
| let tag: string; | ||
| let leaf: boolean; | ||
| let open: boolean; | ||
| let close: boolean; | ||
| function enter(node: any, token: any, callback: any): void; | ||
| let skipEmpty: boolean; | ||
| } | ||
| declare namespace clauseOpenRule { | ||
| let tag_1: string; | ||
| export { tag_1 as tag }; | ||
| let leaf_1: boolean; | ||
| export { leaf_1 as leaf }; | ||
| let open_1: boolean; | ||
| export { open_1 as open }; | ||
| let close_1: boolean; | ||
| export { close_1 as close }; | ||
| export function enter_1(node: any, token: any, callback: any): void; | ||
| export { enter_1 as enter }; | ||
| } | ||
| declare namespace clauseCloseRule { | ||
| let tag_2: string; | ||
| export { tag_2 as tag }; | ||
| let leaf_2: boolean; | ||
| export { leaf_2 as leaf }; | ||
| let open_2: boolean; | ||
| export { open_2 as open }; | ||
| let close_2: boolean; | ||
| export { close_2 as close }; | ||
| } | ||
| export namespace inlines { | ||
| export { formulaRule as formula }; | ||
| } | ||
| export namespace blocks { | ||
| export { clauseOpenRule as block_clause_open }; | ||
| export { clauseCloseRule as block_clause_close }; | ||
| } | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export function Formula(visitor: any, thing: any, children: any, parameters: any, resultString: any, resultSeq: any): void; | ||
| export function Clause(visitor: any, thing: any, children: any, parameters: any, resultString: any, resultSeq: any): void; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
tsconfig.jsonincludeslib/**/*.js, and this package has test files underlib/(e.g.,*.test.js). As a result, runningtscwill emit test declaration stubs intotypes/, which is usually not intended for published typings. Add anexclude(or narrow theinclude) to omit test files and regenerate thetypes/output.