Skip to content
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

fix(generators): Fix generator type declarations #7750

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/dart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {dartGenerator, DartGenerator, Order} from 'blockly-test/dart';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
dartGenerator.forBlock['the_answer'] = function (
_block: Blockly.Block,
_generator: DartGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
28 changes: 28 additions & 0 deletions tests/typescript/src/generators/javascript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {
javascriptGenerator,
JavascriptGenerator,
Order,
} from 'blockly-test/javascript';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
javascriptGenerator.forBlock['the_answer'] = function (
_block: Blockly.Block,
_generator: JavascriptGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/lua.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {luaGenerator, LuaGenerator, Order} from 'blockly-test/lua';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
luaGenerator.forBlock['the_answer'] = function (
_block: Blockly.Block,
_generator: LuaGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/php.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {phpGenerator, PhpGenerator, Order} from 'blockly-test/php';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
phpGenerator.forBlock['the_answer'] = function (
_block: Blockly.Block,
_generator: PhpGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/python.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {pythonGenerator, PythonGenerator, Order} from 'blockly-test/python';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
pythonGenerator.forBlock['the_answer'] = function (
_block: Blockly.Block,
_generator: PythonGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
2 changes: 1 addition & 1 deletion typings/dart.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from 'generators/dart';
export * from './generators/dart';
2 changes: 1 addition & 1 deletion typings/javascript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from 'generators/javascript';
export * from './generators/javascript';
2 changes: 1 addition & 1 deletion typings/lua.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from 'generators/lua';
export * from './generators/lua';
2 changes: 1 addition & 1 deletion typings/php.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from 'generators/php';
export * from './generators/php';
2 changes: 1 addition & 1 deletion typings/python.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from 'generators/python';
export * from './generators/python';