150 questions
0
votes
0
answers
95
views
HTML syntax highlighting inside of template-strings in Sublime Text
In Sublime Text I would like my javascript files to have HTML syntax highlighting inside of template-strings. Until yesterday, I was using a custom syntax I found from this stack overflow which looked ...
0
votes
1
answer
28
views
Can't assign numerical value to numerical template string in typescript
In typescript, I want to assign a number variable to a string variable that only accepts numerical strings. I tried the following:
const x: number = 0;
const y: `${number}` = x.toString();
But ...
0
votes
3
answers
43
views
Is it possible to interpolate a template string using data from an object in JavaScript?
Is it possible to interpolate a template string using key/values from a object in JavaScript, like string substitution in Python:
data = {"age": 18, "name": "John"}
"...
0
votes
1
answer
97
views
Is it possible to add a JSX element to a template string that is within an array of objects?
I'm trying to add JSX elements like <a>, <p> and else to an array of objects in a template string, this project has a portfolio.jsx file that holds the array, another file called Projects....
1
vote
1
answer
4k
views
ESLint with typescript "Parsing error: Type expected" with Template Literal Types
I have this type:
export type ICfnOutput = {
ENDPOINTS: {
[key in `${keyof typeof MSERVICES}_ENDPOINT`]: string
},
USER_POOL_CLIENT_ID: string,
amplifyClientUrl: string,
...
0
votes
1
answer
539
views
Angular Drawflow: How to drop component as node
Is it possible to make the click event working for template strings like this?
const htmlTemplate = `
<div>
<div>
<textarea df-template></textarea>
<button (...
1
vote
1
answer
931
views
Handlebars.js with JavaScript template strings throws error
I'm using plop for code generation of some TypeScript files. This is not using HTML at all. Under the hood plop uses Handlebars for it's templating. One of my templates generates a series of new ...
0
votes
1
answer
1k
views
How to get value of object property using template strings
I have this object totalData which I am destructuring to add on a new object value. I understand I am able to define new object properties using template strings (as shown below) but how can I use ...
0
votes
1
answer
154
views
How to upgrade the docx format to the latest by docx?
👉The original file is docx format, which has multiple tables, but there may be format problems, so it cannot be read by python-docx.
✔️ 1.Solution by hand:
solve the question by click [save as ....]...
0
votes
1
answer
314
views
How can I avoid control character interpretation in Javascript template string interpolation?
I have a string variable containing a control character (newline). I want to output that variable but with the control character as its literal representation and not interpreted:
console.log(`Using &...
0
votes
0
answers
98
views
import dynamically in ReactJs using for to assign an imported const to different objects
Please be patience, my english is not that good. I am trying to create a for loop to push for each image imported, an object with different values. I want to avoid just setting all the objects i want ...
0
votes
1
answer
328
views
Generate variables from JSON to use in string template (Javascript)
I have some JSON that looks a little like this:
component.json
[
{ "template": "<div class="${layout} ${border}"></div>" },
{
"layout": &...
0
votes
1
answer
483
views
Template strings in mongoose update query with typescript [duplicate]
I want to use a template string in a mongoose update query using typescript.
The field I want to update is a Map called messages with string keys and array values of type Message.
So something like
...
3
votes
4
answers
127
views
What is the difference between these two functions involving typeof
My teacher in JavaScript gave me an assignment to master functions. I tried to solve the assignment which requires me to make the output like the second code:
function showDetails(name = "unknown&...
1
vote
0
answers
27
views
Trying to find a way to control background color via 11 different buttons. Question about template strings?
I have 11 buttons with their own class, as well as all 11 share the class .theme-color. I am trying to have it change to the background color on the button class. My idea was to get the class into the ...