Comments (13)
(1) We have successfully tried the below settings
Typescript support feature branch: https://github.com/AddSearch/js-client-library/tree/provide-type-support-for-library
Windows Platform: amazon/Windows_Server-2022-English-Full-Base-2023.05.10
nvm: 1.1.11
node: 10.17.6
npm: 6.14.15
typescript: 5.0.4
react + typescript sample public project: https://github.com/Lemoncode/react-typescript-samples/tree/master/hooks/01_HelloReact
(2) High-level steps
a) js-client-library:
-
in the Windows platform perform the suggested modification in package.json
#12 (comment) -
run
npm install
-
run
npm run build
b) the sample project 01_HelloReact:
- replace hello.tsc with the below content
import * as React from "react";
import AddSearchClient from 'addsearch-js-client';
export const HelloComponent = () => {
let client: any = new AddSearchClient( `<adddsearch customer public key>`);
client.search('keyword', (response: any) => {
console.log(response);
});
return <h2>Hello component !</h2>;
};
- run
npm install
- run
npm install <local directory path to the root of js-client-library>
npm run start
- check localhost:8080 with the network tab for the request with the
<adddsearch customer public key>
.
(3) If the above isn't helpful to resolve your particular issue, then,
- kindly list the relevant technology versions as in section (1) above. Provide other information that you deem useful to replicate your specific environment.
- or to speed up the process it's better to contact our support [1] and pass this Issue thread [2], so we could work out 1. interactively.
[1] https://www.addsearch.com/support/contact-support/
{2] #12
from js-client-library.
I just pull-requested for only class.
DefinitelyTyped/DefinitelyTyped#46203
I hope someone adds for it.
from js-client-library.
@anttiai
I guess it is helpful.
from js-client-library.
Any updates on Typescript support ? Thanks : )
from js-client-library.
Is there a package which can be used in Typescript project? Badly in need of it.
from js-client-library.
@abhinayts we have worked towards bringing Typescript support to the project. Could you take a look at the branch provide-type-support-for-library
and see if this works for you?
from js-client-library.
@jkytomaki I tried to install 0.8.2 but I don't see types installed in module. I am using npm install --save-dev [email protected]. Am I missing anything? Also repo is not building getting error while running npm run build.
[email protected] build **\Repos\js-client-library-provide-type-support-for-library\js-client-library-provide-type-support-for-library
npm run test && ./node_modules/webpack-cli/bin/cli.js
[email protected] test **\Repos\js-client-library-provide-type-support-for-library\js-client-library-provide-type-support-for-library
./node_modules/mocha/bin/mocha.js --recursive --require @babel/register -r esm
'.' is not recognized as an internal or external command,
from js-client-library.
@abhinayts the feature branch is not published to npmjs, so to use it you need to clone the repo to your machine then install it from there.
npm install /path/to/project/folder/js-client-library
Regarding error with npm run build
, you could try removing ./
at the beginning of "test" and "build" script in package.json.
from js-client-library.
removing ./ not helping.
from js-client-library.
In case you are using Windows machine, try editing package.json's scripts with this
"test": "node node_modules/mocha/bin/mocha.js --recursive --require @babel/register -r esm"
"build": "npm run test && node node_modules/webpack-cli/bin/cli.js"
from js-client-library.
@haoAddsearch so after using it the code in my application I am getting error. My application is TS application.
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'prototype')
.next\static\chunks\webpack.js (25:0) @ webpack_require
23 | webpack_require.i.forEach(function(handler) { handler(execOptions); });
24 | module = execOptions.module;
25 | execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
26 | threw = false;
27 | } finally {
28 | if(threw) delete webpack_module_cache[moduleId];
from js-client-library.
@abhinayts we will need to create a bug ticket and look into this. Could you tell which frontend/backend framework your application is using?
from js-client-library.
@haoAddsearch I am trying to use it in react application using typescript.
from js-client-library.
Related Issues (5)
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 js-client-library.