-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
spread operator compatibility #304
Comments
Vue uses Object.assign to fix this problem. Using polyfill will add some extra code, which can simply be avoided. |
* fix: use assign to align with Vue browser support Close #304 * fix: use correct imports * fix: more missed objects * fix: add missing copy
@BenoitRanque Thanks, I removed the spread at 71c28cf. The warning is a bit different, I'm open to proposals to keep it correct in TS and yield a version that works on older Edge versions. Keep in mind, it's removed in production builds, so it should still run fine on production. If it doesn't, there there is something wrong, so yes, please open a new issue! |
The dangling coma is not removed, which is how I found it. Search for https://cdn.bootcdn.net/ajax/libs/vue-router/4.0.0-beta.7/vue-router.global.js |
About the warn method, it is indeed tricky. For now I've got this, but the unused argument is icky, and I still need to type it. Will update asap function warn (msg: string) {
console.warn.apply(console, ['[Vue Router warn]: '].concat(arguments))
} Edit: while this should work on the JS side of things, typescript will probably complain if more than one argument is passed... Ouch |
The dangling comma is fixed at f7ccde0 |
Update: with help on the discord, came up with this: export function warn(msg: string, ...arg: any[]): void
export function warn(msg: string) {
let args = Array.from(arguments).slice(1)
console.warn.apply(
console,
['[Vue Router warn]: ' + msg].concat(args) as [string, ...any[]]
)
} Which, on build, gives this output: function warn(msg) {
let args = Array.from(arguments).slice(1);
console.warn.apply(console, ['[Vue Router warn]: ' + msg].concat(args));
} This should work, but it will need some comments explaining why If this looks good to you, I can create a PR Edit: This does not trigger and TS error on dev or build, should have specified. |
Nice! I had a similar solution but I like yours more and it works better too. |
Awesome! I've just tested it in my project (which uses webview) and it works as expected. Thanks a bunch! |
Version
4.0.0-alpha.12
Reproduction link
https://cdn.bootcdn.net/ajax/libs/vue-router/4.0.0-alpha.12/vue-router.global.js
Steps to reproduce
<link>
and execute the cdn script inEdge@44
.What is expected?
Everything works fine.
What is actually happening?
Page blank, and got console error:
SCRIPT1028: SCRIPT1028: Expected identifier, string or number vue-router.global.js (374,15)
May be we need a polyfiill function for spread operator?
The text was updated successfully, but these errors were encountered: