docs: add TypeScript docs/examples and reorganize by language#186
Conversation
Reorganize examples/ into examples/python/ and examples/typescript/ so the two libraries have parallel, comparable example sets. - Move the 11 existing Python scripts under examples/python/. - Add Python examples for previously-undocumented capabilities: multi_city_search.py and advanced_filters_search.py (alliances, airline exclusions, layover bounds, currency/locale). - Add a mirrored TypeScript example set under examples/typescript/ (one-way, round-trip, dates, multi-city, advanced filters, error handling) with a runnable package.json/tsconfig and README. - Rewrite the top-level examples README as a language index and add per-language READMEs. Drop the inaccurate "automatic dependency checking" claim the scripts never implemented. https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Reorganize the documentation site so each library has its own section, and add first-class TypeScript docs (previously Python-only). - Move Python docs under docs/python/ (quickstart, examples, api/) and fix their internal links and example paths (examples/ -> examples/python/). - Add docs/typescript/ (quickstart + examples) covering install, one-way, round-trip, dates, multi-city, filters/alliances/locale, client config, and typed errors. - Rewrite docs/index.md as a dual-language landing page. - Update mkdocs nav for the Python/TypeScript split and drop the Contributing/Releasing section. Exclude the internal release runbooks from the built site via exclude_docs while keeping the files in-repo. - Update the README example paths, add a TypeScript section, and drop the inaccurate "automatic dependency checking" claims. https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Test Results 4 files - 1 4 suites - 52 1m 17s ⏱️ +21s Results for commit 8054e8a. ± Comparison against base commit e2063b9. This pull request removes 259 tests.♻️ This comment has been updated with latest results. |
Delete docs/guides/release.md and docs/guides/release-npm.md. These are maintainer-internal release runbooks that don't belong on the public docs site; the same process is summarized in CLAUDE.md and is fully defined by the release workflows themselves. Replaces the earlier exclude_docs approach with outright removal and fixes the now-dangling references in CLAUDE.md, AGENTS.md, and publish.yml. https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Resolve modify/delete conflicts on the release runbooks by keeping their removal (main edited them; this branch deletes them). README and CLAUDE.md auto-merge cleanly with main's demo-media relocation and npm tweaks. https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
| } | ||
|
|
||
| for (const [outbound, ret] of itineraries) { | ||
| console.log(`Total: $${outbound.price}`); |
There was a problem hiding this comment.
outbound.price is typed number | null (FlightResult.price can be null when Google doesn't surface a price for premium-cabin results per the JSDoc comment on the type). Printing it directly produces Total: $null in those cases.
| console.log(`Total: $${outbound.price}`); | |
| console.log(`Total: $${outbound.price ?? "N/A"}`); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/typescript/round_trip_search.ts
Line: 52
Comment:
`outbound.price` is typed `number | null` (`FlightResult.price` can be null when Google doesn't surface a price for premium-cabin results per the JSDoc comment on the type). Printing it directly produces `Total: $null` in those cases.
```suggestion
console.log(`Total: $${outbound.price ?? "N/A"}`);
```
How can I resolve this? If you propose a fix, please make it concise.| new FlightSegment({ | ||
| departure_airport: [[[Airport.JFK, 0]]], | ||
| arrival_airport: [[[Airport.LAX, 0]]], | ||
| travel_date: "2026-12-25", |
There was a problem hiding this comment.
Hardcoded travel dates will go stale
The quickstart uses hardcoded dates ("2026-12-25", "2027-01-02") that will pass, causing FlightSegment's constructor to throw "Travel date cannot be in the past" for anyone who copies the snippet verbatim after those dates arrive. The runnable TypeScript examples use inDays(N) to compute dynamic dates — applying the same pattern in the quickstart would keep the samples perpetually valid.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/typescript/quickstart.md
Line: 36
Comment:
**Hardcoded travel dates will go stale**
The quickstart uses hardcoded dates (`"2026-12-25"`, `"2027-01-02"`) that will pass, causing `FlightSegment`'s constructor to throw "Travel date cannot be in the past" for anyone who copies the snippet verbatim after those dates arrive. The runnable TypeScript examples use `inDays(N)` to compute dynamic dates — applying the same pattern in the quickstart would keep the samples perpetually valid.
How can I resolve this? If you propose a fix, please make it concise.Address Greptile review on PR #186: - FlightResult.price is `number | null`; print `?? "N/A"` instead of rendering `$null` for premium-cabin results Google doesn't price. - Replace hardcoded travel dates (which fail FlightSegment's "Travel date cannot be in the past" check once they pass) with dynamic `inDays(N)` dates, matching the runnable example scripts. Applied across all affected TS example scripts and the TS docs snippets, not just the two flagged lines, since they share the same patterns. https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Main's #189 renamed the npm package to the unscoped `fli-js`, but the TypeScript examples and docs still imported from `fli` and pinned `fli@^0.0.2` — which now resolves to an unrelated npm package. Point all imports, install commands, package links, and the example dependency at `fli-js` (^0.0.4). Also future-proof the README's TS snippet date. Typechecked the example scripts against the local fli-js source (tsc, 0 errors). https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Summary
The docs and examples were Python-only and flat, even though the repo ships a 1:1 TypeScript port (
fli-js). This gives both libraries parallel, first-class coverage, and removes maintainer-internal docs from the public site.Examples (
examples/)examples/python/andexamples/typescript/.examples/python/.multi_city_search.py,advanced_filters_search.py(alliances, airline exclusions, layover bounds, currency/locale) — covering capabilities that had no example.examples/typescript/(one-way, round-trip, dates, multi-city, advanced filters, error handling) with a runnablepackage.json/tsconfig.jsonand README.Docs (
docs/)docs/python/(quickstart, examples,api/) and fixed internal links + example paths.docs/typescript/(quickstart + examples).docs/index.mdas a dual-language landing page.docs/guides/release.md,docs/guides/release-npm.md) — maintainer-only content that doesn't belong on the public docs site. The release process stays summarized inCLAUDE.mdand is fully defined by therelease*.ymlworkflows. Fixed the now-dangling references inCLAUDE.md,AGENTS.md, andpublish.yml.README
examples/→examples/python/), added a TypeScript section, and corrected the example list.Validation
mkdocs buildsucceeds with no warnings; verified Python/TypeScript pages build.ruff format --checkandruff checkpass on all examples.encode()-d against the real pydantic models (no network) to confirm field names.fli-jssource API (triple-nested airports[[[Airport.JFK, 0]]], object-literalPassengerInfo,search()locale options).Notes
fli/tests: the wheel packages only["fli"], so root-leveltests/correctly stays out of the published package.Test plan
make docsbuilds without warningsmake lintpassesuv run python examples/python/multi_city_search.pybun run examples/typescript/basic_one_way_search.ts(afterbun install)https://claude.ai/code/session_01VPkFrjXBZkS8Cjzc82X5tp
Greptile Summary
This PR reorganizes the flat
examples/anddocs/trees into parallelpython/andtypescript/subtrees, adding first-class TypeScript coverage to match the existingfli-jsnpm package, and removes maintainer-only release runbooks from the public docs site.basic_one_way_search,round_trip_search,date_range_search,multi_city_search,advanced_filters_search,error_handling_with_retries) plus a runnablepackage.json/tsconfig.json; all verified against thefli-jssource (triple-nested airports, object-literalPassengerInfo,SearchOptionslocale params,Clientconstructor fields).multi_city_search.py,advanced_filters_search.py) covering alliances, airline exclusions, layover bounds, and locale options.docs/python/anddocs/typescript/with a rewritten landing page, updatedmkdocs.ymlnav, and deletion ofdocs/guides/release*.mdrunbooks; dangling references inCLAUDE.md,AGENTS.md, andpublish.ymlcleaned up.Confidence Score: 4/5
Safe to merge — all TypeScript API usage is verified against the fli-js source; the only issues are cosmetic display and doc staleness concerns.
The TypeScript examples correctly use the triple-nested airport format, object-literal PassengerInfo, and all Client/SearchOptions fields. The Python additions also check out against the Pydantic models. The round_trip_search.ts example prints price without a null guard (will show
$nullfor flights where Google omits a price), and the quickstart uses hardcoded dates that will eventually trigger the past-date validation in FlightSegment's constructor. Neither affects library correctness, only the experience of readers who copy the examples verbatim.docs/typescript/quickstart.md (hardcoded dates), examples/typescript/round_trip_search.ts (null price display), mkdocs.yml (stale site_description)
Important Files Changed
outbound.priceprinted without null guard — can emitTotal: $nullwhen Google omits a priceFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD subgraph docs["docs/"] DI[index.md\nDual-language landing] subgraph dp["python/"] DPQ[quickstart.md] DPE[examples.md] subgraph dpa["api/"] DPM[models.md] DPS[search.md] end end subgraph dt["typescript/"] DTQ[quickstart.md] DTE[examples.md] end DG[guides/mcp.md] end subgraph examples["examples/"] subgraph ep["python/"] EP1[basic_one_way_search.py] EP3[multi_city_search.py NEW] EP4[advanced_filters_search.py NEW] EP5[... 8 more] end subgraph et["typescript/"] ET1[basic_one_way_search.ts NEW] ET2[round_trip_search.ts NEW] ET3[date_range_search.ts NEW] ET4[multi_city_search.ts NEW] ET5[advanced_filters_search.ts NEW] ET6[error_handling_with_retries.ts NEW] ET7[package.json / tsconfig.json NEW] end end DI --> dp DI --> dt DI --> DG DTQ --> et DPQ --> epComments Outside Diff (1)
mkdocs.yml, line 3 (link)Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "Merge main into docs-examples-typescript" | Re-trigger Greptile
Context used: