NetWebAssemblyTSTypeGenerator 0.0.0.2
dotnet add package NetWebAssemblyTSTypeGenerator --version 0.0.0.2
NuGet\Install-Package NetWebAssemblyTSTypeGenerator -Version 0.0.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetWebAssemblyTSTypeGenerator" Version="0.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetWebAssemblyTSTypeGenerator --version 0.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NetWebAssemblyTSTypeGenerator, 0.0.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetWebAssemblyTSTypeGenerator as a Cake Addin #addin nuget:?package=NetWebAssemblyTSTypeGenerator&version=0.0.0.2 // Install NetWebAssemblyTSTypeGenerator as a Cake Tool #tool nuget:?package=NetWebAssemblyTSTypeGenerator&version=0.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NetWebAssemblyTSTypeGenerator
Usage
Replace your csproj file.
example
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>package.json</WasmMainJSPath>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<JSPortOverrideTypeDefinitionOutputDir>__REPLACE_ME_YOUR_PROJECT_TYPES_DIR_</JSPortOverrideTypeDefinitionOutputDir>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NetWebAssemblyTSTypeGenerator" Version="*" OutputItemType="Analyzer" />
<CompilerVisibleProperty Include="JSPortOverrideTypeDefinitionOutputDir" />
</ItemGroup>
</Project>
Example
If you pass like this code
using System;
using System.Runtime.InteropServices.JavaScript;
Console.WriteLine("Hello, Console!");
return 0;
public partial class MyClass
{
[JSExport]
internal static string Greeting()
{
var text = $"Hello, World! Greetings from node version: {GetNodeVersion()}";
return text;
}
[JSImport("node.process.version", "main.mjs")]
internal static partial string GetNodeVersion();
}
this generator generates d.ts file
/** Generated: for assemblyName.dll */
export const getTypedAssemblyExports: (originalGetAssemblyExports: Promise<any>) => Promise<
/* AutoGeneratedExportsHelperStart */
{
"MyClass": {
"Greeting": () => any /* TODO */
}
}
/* AutoGeneratedExportsHelperEnd */
>;
/* AutoGeneratedImportsHelperStart */
type ImportModuleNames = 'main.mjs'
type ImportModuleValues<T extends ImportModuleNames> = T extends 'main.mjs'
? {
"node": {
"process": {
"version": () => any /* TODO */
}
}
}
: never;
export const setTypedModuleImports: <T extends ImportModuleNames>(
originalSetModuleImports: (moduleName: string, moduleImports: any) => void,
moduleName: T,
moduleImports: ImportModuleValues<T>
) => void;
/* AutoGeneratedImportsHelperEnd */
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 6.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.0.2 | 386 | 9/19/2022 |