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

sample-app-ts fails to build #1785

Closed
cpcallen opened this issue Jul 17, 2023 · 2 comments · Fixed by google/blockly#7295 or #1799
Closed

sample-app-ts fails to build #1785

cpcallen opened this issue Jul 17, 2023 · 2 comments · Fixed by google/blockly#7295 or #1799
Assignees
Labels
category: example Anything in the examples folder type: bug Something isn't working

Comments

@cpcallen
Copy link
Contributor

Category: Examples

Component

sample-app-ts

Describe the bug

As reported in the forum, this example app fails to build due to type errors from tsc.

To Reproduce

  1. Go to examples/sample-app-ts
  2. Run npm ci && npm build
  3. See error:
ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/index.ts
./src/index.ts 43:23-54
[tsl] ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/index.ts(43,24)
      TS2345: Argument of type '(e: Blockly.Events.UiBase) => void' is not assignable to parameter of type '(e: Abstract) => void'.
  Types of parameters 'e' and 'e' are incompatible.
    Type 'Abstract' is not assignable to type 'UiBase'.
      Types of property 'workspaceId' are incompatible.
        Type 'string | undefined' is not assignable to type 'string'.
          Type 'undefined' is not assignable to type 'string'.

ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/index.ts
./src/index.ts 52:23-54
[tsl] ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/index.ts(52,24)
      TS2345: Argument of type '(e: Blockly.Events.UiBase) => void' is not assignable to parameter of type '(e: Abstract) => void'.
  Types of parameters 'e' and 'e' are incompatible.
    Type 'Abstract' is not assignable to type 'UiBase'.

ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts
./src/generators/javascript.ts 7:8-13
[tsl] ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts(7,9)
      TS2305: Module '"blockly/javascript"' has no exported member 'Order'.
 @ ./src/index.ts 9:0-52 16:35-44

ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts
./src/generators/javascript.ts 21:28-44
[tsl] ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts(21,29)
      TS2445: Property 'provideFunction_' is protected and only accessible within class 'CodeGenerator' and its subclasses.
 @ ./src/index.ts 9:0-52 16:35-44

ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts
./src/generators/javascript.ts 23:31-57
[tsl] ERROR in /Users/cpcallen/src/blockly-samples/examples/sample-app-ts/src/generators/javascript.ts(23,32)
      TS2445: Property 'FUNCTION_NAME_PLACEHOLDER_' is protected and only accessible within class 'CodeGenerator' and its subclasses.
 @ ./src/index.ts 9:0-52 16:35-44

Expected behaviour

App builds correctly.

Additional context

The error concerning Order is actually google/blockly#7283 for which a fix is pending (and this bug report provides a helpful testcase).

@cpcallen cpcallen added type: bug Something isn't working triage category: example Anything in the examples folder labels Jul 17, 2023
cpcallen added a commit to cpcallen/blockly-samples that referenced this issue Jul 17, 2023
Fix the declaration of the arrow functions passed to
addChangeListener have them take Abstract instead of UiBase,
since that is how addChangeListener is declared (and there is
no facility to receive only UiBase events).

Part of google#1785.
cpcallen added a commit to cpcallen/blockly-samples that referenced this issue Jul 17, 2023
The changes made in google#1758 to update generator declarations were
not quite correct; in particular, they did not properly account
for the need to apply Object.assign only to
javascriptGenerator.forBlock, not to all of javascriptGenerator.

Not technically part of google#1785, since it the error was not causing
_build_ failures, but very much necessary to get the sample apps
working again.
cpcallen added a commit to cpcallen/blockly that referenced this issue Jul 17, 2023
Remove the protected declaration on provideFunction_ and
FUNCITON_NAME_PLACEHOLDER_ so they can be used from generator
functions written in TypeScript.

Not strictly part of google#7283, but closely related and required to
fixing the related issue google/blockly-samples#1785.
@cpcallen cpcallen reopened this Jul 17, 2023
@cpcallen
Copy link
Contributor Author

Reopening this until google/blockly#7283 has been fixed and the fix released and blockly-samples minimum Blockly version updated (at least for this repo).

cpcallen added a commit to google/blockly that referenced this issue Jul 17, 2023
…t compatibility (#7295)

* fix(generators): Add missing declarations for Order enums

* chore(generators): Remove spurious whitespace

* fix(generators): Make provideFunction_ etc. public

  Remove the protected declaration on provideFunction_ and
  FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator
  functions written in TypeScript.

  Not strictly part of #7283, but closely related and required to
  fixing the related issue google/blockly-samples#1785.

* chore(generators): format
ericblackmonGoogle pushed a commit to google/blockly that referenced this issue Jul 17, 2023
…t compatibility (#7295)

* fix(generators): Add missing declarations for Order enums

* chore(generators): Remove spurious whitespace

* fix(generators): Make provideFunction_ etc. public

  Remove the protected declaration on provideFunction_ and
  FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator
  functions written in TypeScript.

  Not strictly part of #7283, but closely related and required to
  fixing the related issue google/blockly-samples#1785.

* chore(generators): format

(cherry picked from commit d503fbb)
ericblackmonGoogle added a commit to google/blockly that referenced this issue Jul 17, 2023
* fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295)

* fix(generators): Add missing declarations for Order enums

* chore(generators): Remove spurious whitespace

* fix(generators): Make provideFunction_ etc. public

  Remove the protected declaration on provideFunction_ and
  FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator
  functions written in TypeScript.

  Not strictly part of #7283, but closely related and required to
  fixing the related issue google/blockly-samples#1785.

* chore(generators): format

(cherry picked from commit d503fbb)

* fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297)

* fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors

  Fix the comment / message errors noted in
  #7249 (comment)

* chore: Add renamings for HSV_SATURATION, HSV_VALUE

(cherry picked from commit 1bc4f67)

* release: Update version number to 10.0.2

---------

Co-authored-by: Christopher Allen <[email protected]>
ericblackmonGoogle added a commit to google/blockly that referenced this issue Jul 17, 2023
* fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295)

* fix(generators): Add missing declarations for Order enums

* chore(generators): Remove spurious whitespace

* fix(generators): Make provideFunction_ etc. public

  Remove the protected declaration on provideFunction_ and
  FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator
  functions written in TypeScript.

  Not strictly part of #7283, but closely related and required to
  fixing the related issue google/blockly-samples#1785.

* chore(generators): format

(cherry picked from commit d503fbb)

* fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297)

* fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors

  Fix the comment / message errors noted in
  #7249 (comment)

* chore: Add renamings for HSV_SATURATION, HSV_VALUE

(cherry picked from commit 1bc4f67)

* release: Update version number to 10.0.2

---------

Co-authored-by: Christopher Allen <[email protected]>
@cpcallen
Copy link
Contributor Author

Not sure why GitHub closed this again. It is still not fixed, since sample-app-ts also needs to be updated to Blockly v10.0.2.

@cpcallen cpcallen reopened this Jul 19, 2023
@cpcallen cpcallen self-assigned this Jul 19, 2023
cpcallen added a commit to cpcallen/blockly-samples that referenced this issue Jul 19, 2023
@maribethb maribethb removed the triage label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: example Anything in the examples folder type: bug Something isn't working
Projects
None yet
2 participants