-
-
Notifications
You must be signed in to change notification settings - Fork 255
ci: type-check examples/** and testing/** to catch call-site regressions (#820) #857
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
Open
tombeckenham
wants to merge
1
commit into
main
Choose a base branch
from
820-ci-type-check-is-excluded-from-examples-and-testing-call-site-type-regressions-slip-through-testpr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Type-check this Angular example, including template type-checking. | ||
| // | ||
| // Angular template type-checking (`strictTemplates`) requires the Angular | ||
| // compiler (`ngc`), not plain `tsc`. `ngc` ships in `@angular/compiler-cli`, | ||
| // which is a *peer* dependency of `@angular/build` (a direct devDependency of | ||
| // this example). We resolve it from there instead of declaring it directly so | ||
| // CI's frozen lockfile install stays unchanged. | ||
| import { createRequire } from 'node:module' | ||
| import { spawnSync } from 'node:child_process' | ||
| import { dirname, join } from 'node:path' | ||
|
|
||
| const require = createRequire(import.meta.url) | ||
|
|
||
| // `@angular/compiler-cli` is resolvable from `@angular/build`'s location. | ||
| const buildPkg = require.resolve('@angular/build/package.json') | ||
| const cliPkgPath = require.resolve('@angular/compiler-cli/package.json', { | ||
| paths: [buildPkg], | ||
| }) | ||
| const cliPkg = require(cliPkgPath) | ||
| const ngc = join(dirname(cliPkgPath), cliPkg.bin.ngc) | ||
|
|
||
| const { status } = spawnSync( | ||
| process.execPath, | ||
| [ngc, '-p', 'tsconfig.app.json', '--noEmit'], | ||
| { stdio: 'inherit' }, | ||
| ) | ||
|
|
||
| process.exit(status ?? 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { UIMessage } from '@tanstack/ai-react' | ||
|
|
||
| type ToolResultPart = Extract< | ||
| UIMessage['parts'][number], | ||
| { type: 'tool-result' } | ||
| > | ||
|
|
||
| /** `string | Array<ContentPart>` — a tool result's raw content. */ | ||
| type ToolResultContent = ToolResultPart['content'] | ||
|
|
||
| type ContentPartItem = Exclude<ToolResultContent, string>[number] | ||
|
|
||
| /** | ||
| * Reduce a tool-result part's `content` to a plain string for rendering. | ||
| * | ||
| * Tool results carry `string | Array<ContentPart>` (multimodal results are | ||
| * normalized to an array of content parts upstream). These demos render tool | ||
| * results as plain strings, so array content is flattened to the concatenation | ||
| * of its text parts; non-text parts (image, audio, video, document) have no | ||
| * string form here and are skipped. | ||
| */ | ||
| export function toolResultContentToString(content: ToolResultContent): string { | ||
| if (typeof content === 'string') return content | ||
| return content | ||
| .filter( | ||
| (part): part is Extract<ContentPartItem, { type: 'text' }> => | ||
| part.type === 'text', | ||
| ) | ||
| .map((part) => part.content) | ||
| .join('') | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.