Skip to content
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

Add UMD global declaration to index.d.ts #7868

Merged
merged 1 commit into from
Mar 22, 2018
Merged

Conversation

RyanCavanaugh
Copy link
Contributor

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

Users using Vue from e.g. the CDN might be using the global .Vue without importing the module.

See https://www.typescriptlang.org/docs/handbook/modules.html for details on the syntax

Users using Vue from e.g. the CDN might be using the global `.Vue` without importing the module.

See https://www.typescriptlang.org/docs/handbook/modules.html for details on the syntax
@yyx990803 yyx990803 merged commit 49385e1 into vuejs:dev Mar 22, 2018
@RyanCavanaugh RyanCavanaugh deleted the patch-1 branch March 22, 2018 16:56
@FranklinWhale
Copy link

@yyx990803 This PR is missing in the 2.5.17 release. Is that intended?

@posva
Copy link
Member

posva commented Aug 12, 2018

yes, the latest release only included a security fix

@FranklinWhale
Copy link

@posva Thanks the info. I thought that 2.5.17 included all changes v2.5.17-beta.0 and was a normal release.

@RyanCavanaugh I installed this type definition using npm install github:vuejs/vue. However, the following script is marked as an error by the TypeScript compiler:

const vm = new Vue({
	el: "#test",
	data: "test"
});
// ERROR [ts] Cannot use 'new' with an expression whose type lacks a call or construct signature.

Since the type definition of Vue is specified in package.json, I have set the value of the moduleResolution compiler option to node for the compiler to resolve it. The full content of tsconfig.json is as follows:

{
	"compilerOptions": {
		"target": "es2018",
		"strict": true,
		"noImplicitReturns": true,
		"moduleResolution": "node",
		"outDir": "dist"
	}
}

There is also an index.d.ts file in the project to reference the UMD globally:

/// <reference types="vue"/>

Is there anything missing in my scripts?

f2009 pushed a commit to f2009/vue that referenced this pull request Jan 25, 2019
Users using Vue from e.g. the CDN might be using the global `.Vue` without importing the module.

See https://www.typescriptlang.org/docs/handbook/modules.html for details on the syntax
aJean pushed a commit to aJean/vue that referenced this pull request Aug 19, 2020
Users using Vue from e.g. the CDN might be using the global `.Vue` without importing the module.

See https://www.typescriptlang.org/docs/handbook/modules.html for details on the syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants