mirror of
https://github.com/google/blockly.git
synced 2025-12-15 22:00:07 +01:00
fix(generators): Fix generator type declarations (#7750)
* test(generators): Add generator TS import/use tests * fix(generators): Fix generator type declarations Add a missing ./ prefix to the imports in the generator wrapper .d.ts files. Fixes: #7741
This commit is contained in:
committed by
GitHub
parent
2a20a3a303
commit
4cc4bd573c
24
tests/typescript/src/generators/dart.ts
Normal file
24
tests/typescript/src/generators/dart.ts
Normal file
@@ -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
tests/typescript/src/generators/javascript.ts
Normal file
28
tests/typescript/src/generators/javascript.ts
Normal file
@@ -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
tests/typescript/src/generators/lua.ts
Normal file
24
tests/typescript/src/generators/lua.ts
Normal file
@@ -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
tests/typescript/src/generators/php.ts
Normal file
24
tests/typescript/src/generators/php.ts
Normal file
@@ -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
tests/typescript/src/generators/python.ts
Normal file
24
tests/typescript/src/generators/python.ts
Normal file
@@ -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
typings/dart.d.ts
vendored
2
typings/dart.d.ts
vendored
@@ -4,4 +4,4 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export * from 'generators/dart';
|
||||
export * from './generators/dart';
|
||||
|
||||
2
typings/javascript.d.ts
vendored
2
typings/javascript.d.ts
vendored
@@ -4,4 +4,4 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export * from 'generators/javascript';
|
||||
export * from './generators/javascript';
|
||||
|
||||
2
typings/lua.d.ts
vendored
2
typings/lua.d.ts
vendored
@@ -4,4 +4,4 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export * from 'generators/lua';
|
||||
export * from './generators/lua';
|
||||
|
||||
2
typings/php.d.ts
vendored
2
typings/php.d.ts
vendored
@@ -4,4 +4,4 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export * from 'generators/php';
|
||||
export * from './generators/php';
|
||||
|
||||
2
typings/python.d.ts
vendored
2
typings/python.d.ts
vendored
@@ -4,4 +4,4 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export * from 'generators/python';
|
||||
export * from './generators/python';
|
||||
|
||||
Reference in New Issue
Block a user