Repository navigation
Regenerate the TypeScript types, and make every package's types compile for a TypeScript caller - #113
Merged
Merged
Conversation
npm run tsc on rc changes 23 committed type files and writes one new one, callbackUrl.d.ts, so the types published with each package match what the code now offers. Members tsc leaves out of a subclass, such as CloudRequestEngine.isCacheable, are still declared on the base class with the same type.
Nothing in the repository has a cloudHelpers.js or refers to cloudHelpers, so the file declared a module the package does not hold.
The test compiles, with TypeScript's own API, a file that imports each package with types by its package name, and checks the type files as well. It fails on fiftyone.devicedetection.cloud, whose types import ../fiftyone.devicedetection.cloud/hardwareProfileCloudEngine, which a caller's compiler cannot find.
Two package entry points required a file of their own through ../<their folder>/, which works only while the folder has that name. The cloud package's types then imported the same path from the types folder, where a TypeScript caller cannot find it.
With the require changed, tsc writes the import as ./hardwareProfileCloudEngine.
This was referenced Nov 14, 2026
Open
jwrosewell
marked this pull request as ready for review
November 14, 2026 23:04
Draft
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Each package publishes the
types/*.d.tsfiles committed in this repository, and nothing writes them again before a package is packed. The readmes say that "Calling the generation step is manual for now" (device-detection/readme.mdline 236 at a9a3bd2e). So the published types have fallen behind the code. With TypeScript 5.9.3,npm run tsconrcat a9a3bd2 changes 23 of the committed files and writes one that was never committed,pipeline/fiftyone.pipeline.core/types/callbackUrl.d.ts(run 43580575276).Among what the published types lack today:
DataFileUpdateService, beingaccessError,refreshDataFile,fail,unhandledandintegrityFailed,JSONBundlerElement.getSequenceandDataFile.onUpdateComplete,AUTO_UPDATE_TEMP_PATH_NOT_SETandAUTO_UPDATE_UNKNOWN_ERRORinAutoUpdateStatus,GeoLocationCloud, which is a Cloud Engine in the code and a class with no base in the types, so its types offer none of a Cloud Engine's members,callbackUrl.js, which the core package packs,rcthis week wrote, such as which web integration elementsPipelineBuilderadds (#105) and thatupdateOnStartdownloads a missing data file (#52).pipeline/fiftyone.pipeline.cloudrequestengine/types/cloudHelpers.d.tsdeclaresmakeHTTPRequestfor acloudHelpers.jsthat the package no longer has, and nothing in the repository refers to it.A TypeScript caller that imports
fiftyone.devicedetection.cloudand checks type files, astscdoes unlessskipLibCheckis set, gets an error before and after the types are written again.The package's
index.jsrequires its ownhardwareProfileCloudEngine.jsthrough../fiftyone.devicedetection.cloud/(line 26 at a9a3bd2e), and tsc writes the same path into the types, where it points outside thetypesfolder at a file with no types. The on-premise package'sindex.jsrequiresswigHelpers.jsthe same way (line 27), which works only while the folder keeps its name, though tsc writes that type in full rather than as an import.What changed
npm run tscand committed exactly as tsc wrote them, 23 files changed andcallbackUrl.d.tsadded.cloudHelpers.d.tsis removed.index.jsfiles require their own files through./, and the cloud package'stypes/index.d.tsis written again by tsc, which now imports./hardwareProfileCloudEngine. These two lines are the only change to code.ci/tests/typesCompile.test.js, compiles a file that imports every package with types by its package name, with TypeScript's own API and the type files checked, and fails on any error. It runs among the unit tests of every build.One type becomes more exact.
HardwareProfileCloudEnginefrom the cloud package, which a caller that skips checking type files got asanybecause its import could not be found, now has its real type, so such a caller's use of it is now checked.Evidence.keysgoes from{}toanyandCloudRequestEngine.discoveryfromPromise<any>toany, both wider. Every other change adds a member, moves one within its file, writes the same type another way, asFlowElement.evidenceKeyFilterdoes, or changes a comment.What tsc leaves out, and why no member is lost
CloudRequestEngine.isCacheable,getInternalIgnoringCaseonElementDataDictionaryandAspectDataDictionary, andGeoLocationCloud.dataKeyare no longer written in those classes' own files. TypeScript leaves a member out of a subclass's types when its type, and whether it is read-only or optional, match the base class's member (checker.tslines 10761 to 10768 at TypeScript 5.9.3). Each is still declared on the base class,isCacheableinengine.d.tsline 48,getInternalIgnoringCaseinelementData.d.tsline 39 anddataKeyinflowElement.d.tsline 38, so a caller still sees it. What goes is the subclass's own doc comment.@deprecatednotes on five test constants leave the two shared packages'testConstantstypes. These areenvVars.licenseKeyEnvVarandlegacyEnvVarsinfiftyone.devicedetection.shared, andenvVars.superResourceKeyEnvVar,ipiResourceKeyEnvVarandlicenseKeyEnvVarinfiftyone.ipintelligence.shared. The notes stay in the code (device-detection/fiftyone.devicedetection.shared/lib/testConstants.jslines 37 and 43,ip-intelligence/fiftyone.ipintelligence.shared/lib/testConstants.jslines 29, 35 and 40), and the constants themselves stay in the types. A throwaway run, 43581251325, wrote the types of five small files on TypeScript 5.4.5 and 5.9.3. Neither version writes a@deprecatednote for a property of an object literal, however the object is exported, and both write one only for a property set in a class. So the notes in the committed types had been written by hand, and keeping them would mean committing types that tsc does not write.Tests
Whether the committed types are what
npm run tscwrites. A throwaway workflow, not part of this draft, runsnpm installandnpm run tscon Ubuntu with Node.js 24, adds every.d.tsfile, new ones included, and uploads the difference from the commit.rcat a9a3bd2, wheregit statuslists the 23 changed files and the newcallbackUrl.d.ts.git statuslists nothing and the difference is empty. The same was true at e422e2d, before the test and the require change, in run 43580925952.Whether the types compile for a TypeScript caller.
typesCompile.test.jsran on its own in a throwaway workflow on Ubuntu and Windows with Node.js 24, after ESLint passed on it.Before the test was written, a throwaway run, 43584689955, compiled the TypeScript example
gettingStarted.tsand the same import of every package withtsc --noEmit, once onrcat a9a3bd2 and once on e422e2d. The example compiled with no error on both, and the import gave the one error above on both, so writing the types again broke nothing the example uses and fixed nothing on its own.Full build
Run 43585933895 on
tmp/pr-matrix-113b, started bytools/pr-matrix.pywithout macOS. All 7Setting 'PullRequestSha'lines give this head, a8b05e9, and Configure printed "Left out 2 macOS entries". Each of the six Build and Test jobs, Ubuntu, Ubuntu ARM and Windows on Node.js 22 and 24, passed 1,487 unit tests with 2 skipped,typesCompile.test.jsamong them, and every integration test it ran, with 4 skipped.Each job merges
rcas it is when the job starts, and #112 merged intorcat 10:36 UTC while the build ran. The Ubuntu and Windows jobs on Node.js 22 mergedrcbefore #112 and ran 155 integration tests. The other four merged it with #112, which moveswebIntegrationElements.test.jsto the unit tests aswebElements.test.js, and ran 100, the 55 in that file being the difference.The earlier full build at e422e2d, before the test and the require change, run 43580961614, was green in the same way.
ci/tests/environmentVariableNames.test.jsreads every text file, the types included, for environment variable names, andci/tests/corePackageFiles.test.jschecks that the core package packstypes/index.d.ts, and both passed in each job.macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
What remains
npm run tscwrites, #127. It is left for after this release, because each draft still open that changes code tsc reads would first need its types written again.npm run tscand commit what it writes. #107 has merged intorcsince this body was first written, and because the 51Did package now requires its OWID submodule, tsc also writespipeline/fiftyone.pipeline.did/types/owid-js/v1.d.ts. Whether that file is committed is point 3 of Fail the pull request build when the committed TypeScript types differ from what tsc writes #127.