Comments (9)
For all intents and purposes this would just be:
"parameters": [
{
"name": "keys",
"type": {
"text": "(keyof this)[]"
}
}
]
Right?
from custom-elements-manifest.
this.notify(['a','b','c']);
this.notify(...['a','b','c']);
this.notify('a','b','c');
they're spec'd out as different things, if i'm reading it right:
https://tc39.es/ecma262/#sec-parameter-lists
from custom-elements-manifest.
But these would all be internally handled as being an array, right? No matter how the method is called (or how its specced), the method expects the argument to be an array. Im not sure what value we could add here
from custom-elements-manifest.
it's an array in the function body, but a spread at the call site
so, if the user followed the documentation as you defined it, they would
this.notify(['a','b','c']);
but that would break because keys.map(x => [x, this[x]]
would evaluate to
[
[
['a','b','c'],
/* not something you'd usually index `this` with*/
this[['a','b','c']]
]
]
instead of the intended:
[
['a', this.a],
['b', this.b],
['c', this.c]
]
from custom-elements-manifest.
this.notify(['a','b','c']);
Thats a fair point. How would this look like in the schema, though?
Maybe:
"parameters": [
{
"name": "keys",
"spread": true,
"type": {
"text": "(keyof this)[]"
}
}
]
?
from custom-elements-manifest.
off the top
notify(a, ...keys, b) {}
"parameters": [
{ "name": "a" },
{
"name": "keys",
"rest": true
},
{ "name": "b" }
]
from custom-elements-manifest.
yeah, 🚲
from custom-elements-manifest.
i'd usually reach for an enum rather than a spread, maybe
"kind": "rest"
declare module 'schema' {
export type Parameter {
kind?: "rest"|"spread"
}
}
from custom-elements-manifest.
We should do this, but I think a simple boolean like rest?: true
would probably suffice. There's no other value on the single vs rest axis to represent. spread
isn't a kind of parameter, it's an operation you can use for arguments, but we don't document calls/arguments. rest?: true
goes alone with optional?: true
that we have now.
from custom-elements-manifest.
Related Issues (20)
- Generated schema contains errors HOT 3
- How to output `oneOf` for discriminated unions. HOT 1
- sync between source and manifest HOT 2
- Add support for package and element icons and screenshots HOT 1
- add funding links
- Add support for CSS CustomState
- Add support for symbol-named class members HOT 1
- Add support for including canonical URLs for References
- Needed styles for elements HOT 4
- Package name field HOT 1
- Ability to document type of detail property for CustomEvents HOT 5
- README should mention that manifest can (and should) be generated by a tool
- `tagName` should not be part of the manifest HOT 4
- Publish New Version HOT 1
- Access modifier issue on derived class HOT 1
- Status of the "manifest" HOT 4
- Deomnstration Project using the Manifest... HOT 1
- To which files should the manifest link. .ts, .js, both, ... HOT 8
- componentRegistered Information HOT 1
- desc.startsWith is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from custom-elements-manifest.