-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
export TypingsInstaller from tsserverlibrary #53394
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5846,6 +5846,14 @@ declare namespace ts { | |
emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject<T> | undefined; | ||
} | ||
type InvalidatedProject<T extends BuilderProgram> = UpdateOutputFileStampsProject | BuildInvalidedProject<T> | UpdateBundleProject<T>; | ||
namespace JsTyping { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat unfortunate that this is making it out into the non-server API given there's no actual use for it... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean? The TypingResolutionHost is something I really would have to implement, iiuc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but this is typescript.d.ts, not tsserverlibrary.d.ts, and it's not going to contain the ATA stuff as far as I'm aware (note that the change to this file is type-only). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am pretty sure this is unnecessary if we just switch these to direct import instead of leveraging the following re-export from within export * from "../../jsTyping/_namespaces/ts"; @zkat I think that's a reasonable change to make within this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DanielRosenwasser You mean doing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, our bundling is unfortunately far too restrictive to allow this sort of thing right now. I think it's just going to have to be gross. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hold up, why can't the tests just do a direct import as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bump There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zkat if you change existing instances of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I just realized that we (just below here) already have So, I think I'm okay with this PR as-is. It's no worse than our current API in terms of over-declaring a public API. ATA already leaks into |
||
interface TypingResolutionHost { | ||
directoryExists(path: string): boolean; | ||
fileExists(fileName: string): boolean; | ||
readFile(path: string, encoding?: string): string | undefined; | ||
readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[]; | ||
} | ||
} | ||
namespace server { | ||
type ActionSet = "action::set"; | ||
type ActionInvalidate = "action::invalidate"; | ||
|
@@ -5911,6 +5919,14 @@ declare namespace ts { | |
readonly kind: EventEndInstallTypes; | ||
readonly installSuccess: boolean; | ||
} | ||
interface InstallTypingHost extends JsTyping.TypingResolutionHost { | ||
useCaseSensitiveFileNames: boolean; | ||
writeFile(path: string, content: string): void; | ||
createDirectory(path: string): void; | ||
getCurrentDirectory?(): string; | ||
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher; | ||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher; | ||
} | ||
interface SetTypings extends ProjectResponse { | ||
readonly typeAcquisition: TypeAcquisition; | ||
readonly compilerOptions: CompilerOptions; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of removing internal can we re-export it in server as some other name so that typescript.d.ts doesnt change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not actually work under the naive dts bundler, actually, but we'd have to try.