Typescript template literal strings type error - node.js

A new version of Typescript is allowing to use template litteral strings as types like for example:
type Hey = 'Hey';
type HeyThere = `${Hey} There`;
And it's working very well in the playground of Typescript with the last version which is 4.1.3.
But when I try using it in my projects, I still get the "Type expected. ts(1110)" error in my syntax.
Even though of course I updated the package to the latest version, I also tried to use it in a new project created from scratch and still didn't work. I'm sure it's a very simple mistake but I can't fix it. Also this is very new feature so I can't find much answers online.
Thank you very much for your help!

update ts-loader to version 8 or 9

Related

Solidity compiler error loading specific function

Well, here we are once again.. It seems like there is literally NO docs for the usage of the Solidity compiler in Node.js.. Here is my question.
Context : I want to load a specific version of the Solidity compiler in my Node.js program. In order to do so, I installed the Solidity compiler through npm install solc . Then in my code I declared the solc variable, as follows : var solc = require('solc'). Until there no problem whatsoever.
Problem #1 : solc.loadRemoteVersion(version,callback) seems not to work correctly since this call instantly throw the following error: Error retrieving binaries: not found. Even tho this function is supposed to reach a remote folder on GitHub where all (or almost all) versions of the solidity compiler are stored it seems like it's not even trying to fetch the remote versions (it should at least look take some time before failing miserably)
Problem #2 : solc.useVersion(version) throw another error, more interesting in this case: solc.useVersion() is not a function. This call should go under the folder node_modules/solc/bin/solcjs-version.js and look for the desired version of the compiler but insted it decided to completely not work,
Any help is appriciated. I'm literally stuck on this since two days ago.
The package looks for the full version string, including the commit ID - not just the version number. See the wrapper.ts source.
You can find the specific full version strings in list.json that is mentioned in the docs.
And here is a working example:
solc.loadRemoteVersion("v0.8.0+commit.c7dfd78e", (err, solcSnapshot) => {
// prints: 0.8.0+commit.c7dfd78e.Emscripten.clang
console.log(solcSnapshot.version());
});

`fake-timers` 7.1.x compile error "Cannot find name 'queueMicrotask'."

I'm trying to compile a Salesforce sfdx plugin which is a node project with (among others) the following dependency chain that ultimately leads to fake-timers#^7.1.0:
#salesforce/command#2.2.0 -> #oclif/test#^1.2.4 -> fancy-test#^1.4.3 -> #types/sinon#* -> #sinonjs/fake-timers#^7.1.0.
When compiling it with the Typescript compiler tsc, I get the following error:
node_modules/#sinonjs/fake-timers/types/fake-timers-src.d.ts:11:28 - error TS2304: Cannot find name 'queueMicrotask'.
11 queueMicrotask: typeof queueMicrotask;
~~~~~~~~~~~~~~
Found 1 error.
error Command failed with exit code 1.
This looks like a bug in fake-timers-src.d.ts but introduced in 7.1.0 so I could try to lock the version at 7.0.5 but that might break all kinds of other things.
Does anybody who uses/maintains fake-timers know how to fix this? Or will this be fixed in a future version?
BTW I'm a total NodeJS n00b so if there's something really obvious here that I'm missing, please be kind and just tell me what it is :)
Thanks!
Frans
Frans! fatso83 from the Sinon team here :)
The problem here has all to do with TypeScript and nothing to do with Node, so I feel your pain. No wonder you are wondering. The problem is that the definitions are probably missing that property. For version 7 we tried to generate TypeScript definitions from JSDoc. This works reasonably well for simpler type, but ultimately, TypeScript is more powerful in describing types than JSDoc (like the typeof operator), so it was an uphill battle that would never result in the same quality as the types available from the external Definitely Typed project. We ended up abandoning that effort and therefore this will not be fixed, but it will naturally go away with version 8 (that will not be shipping its own types).
What you can do is this: npm install #sinonjs/fake-timers#6 (which is the previous version) and npm install #types/sinonjs__fake-timers#6 (which are the externally maintained types).
You might find some background for this in this issue.

Naming an Ngram document after a string. Julia v1.1.1

I am running Julia v1.1.1 on a windows 10 machine.
I recently went back to update my Julia v0.6.2 code to Julia v.1.1.1 as my code is no longer supported in Julia v0.6.2 anymore.
I was wondering if anyone knows how to name an Ngramdocument after a string, I think the function used to do this was in the TextAnalysis package :
name!(Ngramdocument, string)
However, recently now that I am trying to update my code to Julia v1.1.1 it is saying that the function is undefined. I was wondering if maybe I was wrong in assuming that the function was defined in the TextAnalysis.jl package or if they changed the name. I have not been able to find documentation of a name change however.
name! was changed to title!. title!(Ngramdocument, string) should work as expected in Julia 1.1.1 with the recent TextAnalysis.jl release. You can see the relevant pull request here.
While migrating code, if you face such undefined function errors, you may quickly find the changes looking at the commit history of the package repository or using search function on the GitHub repo of the package.

Rustpkg fails to build a package

I tried to build the example package from here but sadly I get following error:
error: Couldn't find package std in any of the workspaces in the RUST_PATH (C:\U
sers\User\Desktop\test\hello.rust:C:\Users\User\Desktop\test\hello:C:\Users\Use
r.rust)
Now it's kinda obvious that there is some issue with RUST_PATH but I am somewhat unable to find documentation concerning it.
note: I'm using Windows 8 64 bit and Rust 0.8
Rustpkg has been removed from basic library and moved into librustpkg.
There are alternatives like Makefile or CMake, but I assume the preferred version it's using cargo-lite.
My advice is just look at Rust-CI for a project that uses package manager you like most and copy it's build shamelessly.
UPDATE: A new package manager for rust has been announced. It's called Cargo. We'll see how it works out, but that is possible future default.
Rustpkg has been removed from Rust. Hopefully we will get something to replace it.

Where did HttpProviders go in IAppHost?

I'm having problems in a project that runs on the v3.9.0.0 version of servicestack.
So I'm trying to download source for it. But on github there are no tags so it seems I cant get hold of the source. So... I downloaded the latest stack and the source for that.
Obviously I'm getting some deprecated warnings but except for that the compiler seems happy enough except for in one place
public virtual void Configure(IAppHost appHost, Container container)
{
appHost.HtmlProviders.Add(new HtmlProvider().ProcessRequest);
The compiler complains that IAppHost does not have a property HtmlProviders
Like so:
ServiceStack.WebHost.Endpoints.IAppHost does not contain a definition for HtmlProviders and no extension method 'HtmlProviders' accepting a first argument of type ServiceStack.WebHost.Endpoints.IAppHost could be found (are you missing a using directive or an assembly reference?)
I can't find anyone mentioning this missing so I'm guessing I'm missing something but what.
So at the end I guess the questions are:
Does anyone know how to get the source for the v3.9.0.0 version of servicestack?
Does anyone know what to do to migrate from v3.9.0.0 to current 3.x version considering the above HtmlProviders problem?
(I edited this post as I misread the version number at first)
Checking history for IAppHost your probably looking for roughly v3.94, about 10 months ago. How to upgrade to latest version? I'd suggest migrating a single service to the new API and going from there.

Resources