···490490 run: make
491491 working-directory: ./test/javascript_prelude
492492493493+ - name: Test generated TypeScript declarations
494494+ run: make test
495495+ working-directory: ./test/typescript_declarations
496496+493497 - name: Test export of hex tarball
494498 run: make test
495499 working-directory: ./test/hextarball
+5
Makefile
···2424 cd test/project_javascript && cargo run clean && cargo run check && cargo run test
2525 cd test/project_deno && cargo run clean && cargo run check && cargo run test
2626 cd test/hextarball && make test
2727+ cd test/typescript_declarations && make test
2728 cd test/running_modules && make test
2829 cd test/subdir_ffi && make
2930···5859.PHONY: export-hex-tarball-test
5960export-hex-tarball-test: ## Run `gleam export hex-tarball` and verify it is created
6061 cd test/hextarball && make test
6262+6363+.PHONY: typescript-declarations-test
6464+typescript-declarations-test: ## Check that generated TypeScript declaration compile
6565+ cd test/typescript_declarations && make test
61666267.PHONY: benchmark
6368benchmark: ## Run the benchmarks
+1-1
compiler-core/src/javascript/decision.rs
···816816 match check {
817817 // On JavaScript, a single "character" is one that can be represented as
818818 // a single UTF-16 codepoint.
819819- RuntimeCheck::StringPrefix { prefix, rest } if utf16_no_escape_len(prefix) == 1 => {
819819+ RuntimeCheck::StringPrefix { prefix, .. } if utf16_no_escape_len(prefix) == 1 => {
820820 convert_string_escape_chars(prefix)
821821 .chars()
822822 .next()
···11+import type { Option$ } from "./build/dev/javascript/gleam_stdlib/gleam/option.d.mts";
22+import type { List } from "./build/dev/javascript/typescript_declarations/gleam.d.mts";
33+import * as gleam from "./build/dev/javascript/typescript_declarations/typescript_declarations.mjs";
44+55+gleam.const_int satisfies number
66+gleam.const_int_alias satisfies number
77+gleam.const_int_list satisfies List<number>
88+gleam.const_string_list satisfies List<string>
99+gleam.const_tuple satisfies [string, number]
1010+gleam.either_int satisfies gleam.Either$<number, number>
1111+gleam.function_int_int_returns_int_alias satisfies (a: number, b: number) => number
1212+gleam.function_closure_returns_fn_int_which_returns_int_alias satisfies () => (a: number) => number
1313+1414+type GenericFn<T = any> = (a: T, fn: (a: T) => T) => T;
1515+gleam.function_generic_fn_generic_which_returns_generic_returns_generic satisfies GenericFn
1616+1717+gleam.function_int_int_returns_int satisfies (a: number, b: number) => number
1818+gleam.function_option satisfies () => Option$<number>
+9
test/typescript_declarations/manifest.toml
···11+# This file was generated by Gleam
22+# You typically do not need to edit this file
33+44+packages = [
55+ { name = "gleam_stdlib", version = "0.62.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "0080706D3A5A9A36C40C68481D1D231D243AF602E6D2A2BE67BA8F8F4DFF45EC" },
66+]
77+88+[requirements]
99+gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
···11+import gleam/option.{type Option}
22+33+/// Alias to Int
44+pub type IntAlias =
55+ Int
66+77+/// Int constant
88+pub const const_int: Int = 0
99+1010+/// Constant with type of Int alias
1111+pub const const_int_alias: IntAlias = 0
1212+1313+/// String list constant
1414+pub const const_string_list: List(String) = ["hello", "world"]
1515+1616+/// Int list constant
1717+pub const const_int_list: List(Int) = [0, 1, 2]
1818+1919+/// Tuple constant
2020+pub const const_tuple = #("hello", 0)
2121+2222+/// Add two numbers
2323+pub fn function_int_int_returns_int(first a: Int, second b: Int) -> Int {
2424+ a + b
2525+}
2626+2727+/// Alias to add function
2828+pub const function_int_int_returns_int_alias = function_int_int_returns_int
2929+3030+/// Return function that will add one to given number
3131+pub fn function_closure_returns_fn_int_which_returns_int_alias() -> fn(Int) ->
3232+ IntAlias {
3333+ let func = function_int_int_returns_int_alias(1, _)
3434+ func
3535+}
3636+3737+pub fn function_generic_fn_generic_which_returns_generic_returns_generic(
3838+ val: a,
3939+ function: fn(a) -> a,
4040+) -> a {
4141+ function(function(val))
4242+}
4343+4444+pub type Either(a, b) {
4545+ Left(a)
4646+ Right(b)
4747+}
4848+4949+pub const either_int: Either(Int, Int) = Left(2)
5050+5151+pub fn function_option() -> Option(Int) {
5252+ option.Some(0)
5353+}