I'm trying to allow '@' functions in my application, what should I add or insert to allow JS to interpret it, just like "angular2 @Component".
How to allow '@' keyword in Javascript
265 Views Asked by Jasdev Sidhu At
2
There are 2 best solutions below
0
Michael Troger
On
According to a variable name validator for JavaScript, @ is a:
invalid identifier according to ECMAScript 6 / Unicode 8.0.0
And so it is invalid for function names as well. See also: What characters are valid for JavaScript variable names? In Angular you actually use TypeScript and they make use of @ as a decorator of a function, but it's not used in a function name.
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in TYPESCRIPT
- It doesnt always show all the books on my homepage
- S3 integration testing
- Make some of the type's field optional
- storybook 7 does not recognize module declarations
- Page in React only renders elements after refreshing
- Error Inserting into Supabase: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member
- vscode, debug angular, first time, doesn't debug, 2nd time stops at main.js then it's ok
- Get remote MKV file metadata using nodejs
- Vue/TailwindCSS - Content is behind Sidebar
- TypeScript Error only on big type only when assigned to a variable
- pnpm firebase app "Could not find a declaration file for module 'mime'"
- TypeScript: Type checking while parsing an arbitrary JSON that is typed/
- Issue with BBCode image tag on React
- Typescript: returnType based on value 'single' prop
- Failed to resolve import, but the path is valid, and detected as such by VSCode
Related Questions in ECMASCRIPT-6
- Doesnt update state after successfully fulfilled Reducers
- Adding values dynamically inside useState in ReactJS
- removeEventListener for transitionend not working
- several compilation errors in Typescrip+express+typeorm
- Is there a way to console log/error and return from a function in one line using ES6 syntax?
- "no lockfile entry" while importing remote JSON over http
- React and Material-UI Autocomplete Multiple Items
- When I run the server in javascript and combine html and tsx formatted files and present them to the server, I get an error in css
- Why is assigning a value to super in the constructor in the ES6 standard? It is assigning a value to an instance of the class
- Router cannot be exported when using es6 syntax
- In node using modules. how to change require to import for stripe
- Add callback function to tailwind "duration" animation
- TypeError: Named parameters can only be passed within plain objects, while trying to handle Sqlite errors using ES6 arrow functions
- error in the operation of the -dev flag NPM
- Is Map a set of keys (JavaScript the Definitive Guide - David Flanagan) or a set of key-value pairs (MDN)?
Related Questions in INTERPRETER
- Reference: Crafting Interpreters. Print statement is not able to evaluate expression. Help me fix this (details below)
- Resolve shift/reduction conflict in grammar for expressions in PLY for calls to embedded functions
- Why I select inherit global site-packages on Pycharm, nothing happened?
- How to use menhir to parse into a GADT expression?
- PyCharm cannot create Interpreter in Python3
- When using a jupyter notebook in VSCode, the Python interpreter is ignored
- How to share lexical environment with recursive functions in a custom interpreter?
- How do I write an implicit cast for my strongly typed interpreter? (C++)
- 32bit and 64bit python interpreter in one project
- python subprocess calling the local interpreter instead of the linked one
- Handling out of reach environments when implementing an interpreter
- PyCharm: ModuleNotFoundError although module (scipy) is installed
- Matlab: Selectable text in EPS-figures when using latex interpreter and/or importing fonts
- Handling Tuple Values in Word Attributions for Transformers Interpret
- OpenJDK Tracking ReentrantLock lock and unlock
Related Questions in ECMA
- Can we assign Array to the key of Record and Object in index of Tuples in Javascript?
- ECMA Regex match everything till first occurrence of exact string
- Mock-ing Commander for Unit Testing
- Recursive Regex for Parsing SGF with JS
- JS Regex for Parsing SGF (Meta)data
- What does mean for loop with one semicolon?
- Autofilters noticed in my Excel XML, but non-matching rows not being hidden
- Text on multiple lines without spaces as string literals
- Cannot write to chrome.storage in extension
- Javascript package import cannot find package
- JS Drag&Drop on Firefox / Android not working
- What does "~" (tilde) mean in the import ... from "~/"
- Check if a class has an explicit static constructor?
- Node JS file cannot import a JS class
- Why visual studio code call Closure objects that aren't a closure
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The
@is used as a decorator in a new proposed feature for JavaScript. To use it you need to use a preprocessor like Babel. It is also available in typescript and widely used in Angular2. Example:Decorators will not work by default on Babel, you can find information on enabling them here.
Edit: Whether you consider
@myDecorator('myValue')as@being part of the function name or not, I think we can all acknowledge that it would look this way to those new to the language.Related Links:
https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841 https://cabbageapps.com/fell-love-js-decorators/