Open
Conversation
Co-authored-by: FloEdelmann <202916+FloEdelmann@users.noreply.github.com>
Co-authored-by: FloEdelmann <202916+FloEdelmann@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate from JavaScript to TypeScript
Migrate from JavaScript to TypeScript
Mar 6, 2026
FloEdelmann
reviewed
Mar 7, 2026
…JSDoc comments Co-authored-by: FloEdelmann <202916+FloEdelmann@users.noreply.github.com>
Owner
|
@copilot resolve conflicts with master and add generated types to package.json |
…ations to exports Co-authored-by: FloEdelmann <202916+FloEdelmann@users.noreply.github.com>
Contributor
Author
Done in 6fc92d0. Here's what was done: Conflicts resolved with main:
Generated types added to
"types": "./dist/embetty-vue.d.ts",
"exports": {
".": {
"types": "./dist/embetty-vue.d.ts",
"import": "./dist/embetty-vue.mjs",
"require": "./dist/embetty-vue.cjs"
},
...
} |
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.
Converts all source files from JavaScript to TypeScript, providing static type checking, better developer tooling, and catching type errors at compile time rather than runtime.
New files
tsconfig.json— usesmoduleResolution: "node10"(required for Vue 2.7 wildcarddeclare module '*.vue'to resolve relative imports)src/types.ts— shared interfaces:EmbettyVueOptions,VideoData,VideoImplsrc/env.d.ts— module augmentation (must haveexport {}) to extend Vue'sComponentCustomPropertieswith_embettyVueOptionssrc/shims-vue.d.ts— ambient declarations for*.vueimports andbabel-preset-minify(must be a non-module file for wildcard matching to work on relative imports), usingimport('@babel/core').ConfigAPI/TransformOptionsfor proper Babel typesMigrated source files
src/plugin.js→.tsusingPluginObject<EmbettyVueOptions>src/browser-wrapper.js→.tsusingVueConstructorfrom Vue's type exportssrc/main.js→.tsvite.config.js→.tssrc/components/video-impl/*.js→.ts, each now implements theVideoImplinterfaceVue SFCs
All components updated to
<script lang="ts">withdefineComponent.EmbettyTweetintroduces a typedTweetDatainterface. All original JSDoc comments are preserved with@param,@returns,@override, and@throwstags — only the inline JSDoc type annotations are removed (as they are now managed by TypeScript).Generated TypeScript declarations
vite-plugin-dtsis used to generate.d.tsdeclaration files duringbuild:libdist/(alongside the compiled JS) and published via"files": ["dist"]package.jsonnow exposes a"types"top-level field and a"types"condition (ordered before"import"/"require") in the"exports"entry:Tooling
eslint.config.js— addstypescript-eslint,eslint-plugin-package-json, replacesno-unused-varswith@typescript-eslint/no-unused-vars, configuresvue-eslint-parserwith the TypeScript inner parser for.vuefilespackage.json— addstype-checkscript (tsc --noEmit),exports,files,sideEffectsfieldstypescript,typescript-eslint,@types/node,@types/babel__preset-env,@types/babel__core,vite-plugin-dts,eslint-plugin-package-jsonOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.