Skip to content

docs(lessons): annotate a global with const and a local with let - #5364

Merged
rossirpaulo merged 1 commit into
canaryfrom
paulo/lesson-typed-variables
Oct 21, 2026
Merged

rossirpaulo merged 1 commit into
canaryfrom
paulo/lesson-typed-variables

Conversation

@rossirpaulo

@rossirpaulo rossirpaulo commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #5325, addressing CodeRabbit's review of it (an "outside diff range" note on typescript2/app-website/lessons/everything.md).

The lesson's Variables section now teaches const for a global at file scope and let for a local inside a function. The "Annotating Variable Types" example right after it still showed two bare top-level let lines, which contradicts that and, copied as written, gives the new "global variables are declared with const" error. It now shows the annotation on a const global and on a let local inside a function:

// A global variable with a type annotation
const name: string = "Bammy";

function Example() {
    // A local variable with a type annotation
    let r: int | string = someComplicatedFunction();
}

Only this example changes. The lesson's other bare let snippets are fragments illustrating arrays, maps and loops rather than declarations, so they're left as they are.

Notes

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
developer-docs Ready Ready Preview Oct 21, 2026 10:37pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 41638b34-035a-43db-a864-ce2458b90531
📥 Commits

Reviewing files that changed from the base of the PR and between def2a0e and b40ce46.

⛔ Files ignored due to path filters: 9
  • baml_language/crates/baml_tests/snapshots/broken_syntax/removed_scoped_type_syntax/baml_tests__broken_syntax__removed_scoped_type_syntax__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_assignment/baml_tests__diagnostic_errors__global_variable_assignment__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_assignment/baml_tests__diagnostic_errors__global_variable_assignment__10_formatter__assignment.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_declarations/baml_tests__diagnostic_errors__global_variable_declarations__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_declarations/baml_tests__diagnostic_errors__global_variable_declarations__10_formatter__declarations.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_initializers/baml_tests__diagnostic_errors__global_variable_initializers__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/global_variable_initializers/baml_tests__diagnostic_errors__global_variable_initializers__10_formatter__initializers.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/top_level_let/baml_tests__diagnostic_errors__top_level_let__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/top_level_let/baml_tests__diagnostic_errors__top_level_let__10_formatter__test.snap is excluded by !**/*.snap
📒 Files selected for processing: 73
  • baml_language/ARCHITECTURE.md
  • baml_language/crates/baml_builtins2/keyword_docs/baml_keywords.yaml
  • baml_language/crates/baml_cli/src/bytecode_cache.rs
  • baml_language/crates/baml_cli/src/run_command.rs
  • baml_language/crates/baml_compiler2_ast/src/ast.rs
  • baml_language/crates/baml_compiler2_ast/src/docstring.rs
  • baml_language/crates/baml_compiler2_ast/src/lower_cst.rs
  • baml_language/crates/baml_compiler2_ast/src/lower_expr_body.rs
  • baml_language/crates/baml_compiler2_ast/src/lowering_diagnostic.rs
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_emit/src/items.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_compiler2_emit/src/package/finish.rs
  • baml_language/crates/baml_compiler2_emit/src/refs.rs
  • baml_language/crates/baml_compiler2_hir/src/item_data/lets.rs
  • baml_language/crates/baml_compiler2_hir/src/item_tree/builder.rs
  • baml_language/crates/baml_compiler2_hir/src/item_tree/lets.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/diagnostics.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/extern_loc.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/globals.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/infer.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/init_io.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/lib.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/lower.rs
  • baml_language/crates/baml_compiler2_hir_ty/src/package_interface.rs
  • baml_language/crates/baml_compiler2_mir/src/inference_provider.rs
  • baml_language/crates/baml_compiler2_mir/src/ir.rs
  • baml_language/crates/baml_compiler2_mir/src/lib.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_db/src/check.rs
  • baml_language/crates/baml_db/src/db.rs
  • baml_language/crates/baml_fmt/src/ast/declarations.rs
  • baml_language/crates/baml_fmt/src/ast/mod.rs
  • baml_language/crates/baml_fmt/src/lib.rs
  • baml_language/crates/baml_ide/src/annotations.rs
  • baml_language/crates/baml_ide/src/completion.rs
  • baml_language/crates/baml_ide/src/completion/declarations.rs
  • baml_language/crates/baml_ide/src/describe.rs
  • baml_language/crates/baml_ide/src/global_variable_tests.rs
  • baml_language/crates/baml_ide/src/info.rs
  • baml_language/crates/baml_ide/src/lib.rs
  • baml_language/crates/baml_ide/src/mounted_package_tests.rs
  • baml_language/crates/baml_ide/src/resolve.rs
  • baml_language/crates/baml_ide/src/tokens.rs
  • baml_language/crates/baml_ide/src/tokens/classify.rs
  • baml_language/crates/baml_ide/src/tokens/index.rs
  • baml_language/crates/baml_ide/src/usages.rs
  • baml_language/crates/baml_linker_types/src/lib.rs
  • baml_language/crates/baml_tests/baml_src/ns_compiler/ns_mixed_suite_diagnostics/core_diagnostics.baml
  • baml_language/crates/baml_tests/baml_src/ns_global_variables/global_variables.baml
  • baml_language/crates/baml_tests/baml_src/ns_global_variables/ns_package_shadowing/package_shadowing.baml
  • baml_language/crates/baml_tests/baml_src/ns_global_variables/ns_settings/settings.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/global_variable_assignment/assignment.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/global_variable_declarations/declarations.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/global_variable_initializers/initializers.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/top_level_let/test.baml
  • baml_language/crates/baml_tests/tests/global_variables.rs
  • baml_language/crates/baml_tests/tests/hir_ty_package_interface.rs
  • baml_language/crates/baml_tests/tests/runtime_mount_parity.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/crates/bex_engine/src/lib.rs
  • baml_language/crates/bex_engine/src/telemetry/failure_tests.rs
  • baml_language/crates/bex_heap/README.md
  • baml_language/crates/bex_project/src/runtime_compile.rs
  • baml_language/crates/bex_vm/src/vm.rs
  • baml_language/crates/bex_vm_types/src/errors.rs
  • baml_language/crates/bex_vm_types/src/lib.rs
  • baml_language/crates/bex_vm_types/src/types/function.rs
  • baml_language/crates/bex_vm_types/src/types/package.rs
  • skills/baml-core/SKILL.md
  • typescript2/app-website/lessons/everything.md
+-----------------------------------------------------------------------------------------+
| The function of good software is to make the complex appear to be simple. - Grady Booch |
+-----------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

Base automatically changed from paulo/global-variables to canary October 21, 2026 22:06
The "Annotating Variable Types" example showed two bare top-level `let`
lines right after the Variables section teaches `const` at file scope and
`let` inside a function. Copied as written, it is now the "global
variables are declared with `const`" error. Show the annotation on a
`const` global and on a `let` local inside a function.

Follow-up to #5325, from CodeRabbit's review of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rossirpaulo
rossirpaulo force-pushed the paulo/lesson-typed-variables branch from b40ce46 to 8310bfa Compare October 21, 2026 22:08
@rossirpaulo
rossirpaulo added this pull request to the merge queue Oct 21, 2026
Merged via the queue into canary with commit cac5dd0 Oct 21, 2026
58 of 59 checks passed
@rossirpaulo
rossirpaulo deleted the paulo/lesson-typed-variables branch October 21, 2026 22:11

This branch was successfully deployed

1 active deployment
Preview – developer-docs — 8310bfa0 Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant