-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 typings #7727
Conversation
@@ -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/**/*`, |
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.
Shouldn't this still exist if this is where the reexports are coming from?
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.
It is being deleted from the ignore:
clause, thus causing it to be included in what gets copied from build/
to dist/
.
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.
haha ok sweet sorry about that.
Darn it: this PR should have had a "!" in its title, and so especially should the squash commit, which didn't get a "BREAKING CHANGE:" text in the description. I'm going to rename the PR in the hopes that that is enough to make the release notes come out correctly. 🤞 |
The basics
The details
Resolves
Fixes #7652.
Proposed Changes
package_tasks.js
to includetsc
-generated.d.ts
files for the generators indist
when building theblockly
NPM package..d.ts
files for the generator chunks with ones that reexport the types from the correspondingtsc
-generated.d.ts
file.Reason for Changes
Publish accurate typings for the generators.
Additional Information
BREAKING CHANGE: Previously the
dartGenerator
,luaGenerator
,javascriptGenerator
,phpGenerator
, andpythonGenerator
exports (from theblockly/dart
,blockly/lua
,blockly/javascript
,blockly/php
andblockly/python
entrypoints respectively) were being typedany
. Now their types are correct. There is no change to their runtime behaviour, but developers who have written code in TypeScript that manipulates generators (adding custom block generator functions, for example) may find they need to correct type error in their code in order for it to compile correctly with Blockly v11.Notably, block generator functions to be installed in the
javascriptGenerator.forBlock
dictionary should be typed—and similarly for each of the other four languages we support.