mirror of
https://github.com/google/blockly.git
synced 2026-01-24 01:00:11 +01:00
fix: manually add typings for generator classes (#7824)
* fix: manually add typings for generator classes * fix: use real generated type for class
This commit is contained in:
committed by
GitHub
parent
0b25a8a27f
commit
d1cca3c09a
@@ -348,7 +348,6 @@ function packageDTS() {
|
||||
return gulp.src(handwrittenSrcs, {base: 'typings'})
|
||||
.pipe(gulp.src(`${TYPINGS_BUILD_DIR}/**/*.d.ts`, {ignore: [
|
||||
`${TYPINGS_BUILD_DIR}/blocks/**/*`,
|
||||
`${TYPINGS_BUILD_DIR}/generators/**/*`,
|
||||
]}))
|
||||
.pipe(gulp.replace('AnyDuringMigration', 'any'))
|
||||
.pipe(gulp.dest(RELEASE_DIR));
|
||||
|
||||
31
tests/typescript/src/generators.ts
Normal file
31
tests/typescript/src/generators.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as Blockly from 'blockly-test/core';
|
||||
import {JavascriptGenerator} from 'blockly-test/javascript';
|
||||
import {PhpGenerator, phpGenerator, Order} from 'blockly-test/php';
|
||||
import {LuaGenerator} from 'blockly-test/lua';
|
||||
import {PythonGenerator} from 'blockly-test/python';
|
||||
import {DartGenerator} from 'blockly-test/dart';
|
||||
|
||||
JavascriptGenerator;
|
||||
PhpGenerator;
|
||||
LuaGenerator;
|
||||
PythonGenerator;
|
||||
DartGenerator;
|
||||
|
||||
class TestGenerator extends PhpGenerator {}
|
||||
|
||||
const testGenerator = new TestGenerator();
|
||||
|
||||
testGenerator.forBlock['test_block'] = function (
|
||||
_block: Blockly.Block,
|
||||
_generator: TestGenerator,
|
||||
) {
|
||||
return ['a fake code string', Order.ADDITION];
|
||||
};
|
||||
|
||||
phpGenerator.quote_();
|
||||
2
typings/dart.d.ts
vendored
2
typings/dart.d.ts
vendored
@@ -26,3 +26,5 @@ export enum Order {
|
||||
}
|
||||
|
||||
export declare const dartGenerator: any;
|
||||
|
||||
export {DartGenerator} from './generators/dart';
|
||||
|
||||
2
typings/javascript.d.ts
vendored
2
typings/javascript.d.ts
vendored
@@ -43,3 +43,5 @@ export enum Order {
|
||||
}
|
||||
|
||||
export declare const javascriptGenerator: any;
|
||||
|
||||
export {JavascriptGenerator} from './generators/javascript';
|
||||
|
||||
2
typings/lua.d.ts
vendored
2
typings/lua.d.ts
vendored
@@ -20,3 +20,5 @@ export enum Order {
|
||||
}
|
||||
|
||||
export declare const luaGenerator: any;
|
||||
|
||||
export {LuaGenerator} from './generators/lua';
|
||||
|
||||
2
typings/php.d.ts
vendored
2
typings/php.d.ts
vendored
@@ -45,3 +45,5 @@ export enum Order {
|
||||
}
|
||||
|
||||
export declare const phpGenerator: any;
|
||||
|
||||
export {PhpGenerator} from './generators/php';
|
||||
|
||||
2
typings/python.d.ts
vendored
2
typings/python.d.ts
vendored
@@ -29,3 +29,5 @@ export enum Order {
|
||||
}
|
||||
|
||||
export declare const pythonGenerator: any;
|
||||
|
||||
export {PythonGenerator} from './generators/python';
|
||||
|
||||
Reference in New Issue
Block a user