Hi guys 😁! Long time no new articles!
Today, I am going to show you how to compose React providers with TypeScript.
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Subscriptions</title> | |
<style> | |
.subscriptions { | |
width: 100%; |
declare global { | |
namespace NodeJS { | |
interface Global { | |
yourUtility(...args: any[]): void; | |
} | |
} | |
} |
const path = require('path'); | |
const webpack = require('webpack'); | |
/** @type {webpack.Configuration} */ | |
const developmentConfiguration = { | |
mode: 'development', | |
target: 'node', | |
entry: path.resolve(__dirname, './index.js'), | |
output: { | |
path: path.resolve(__dirname, 'dist', 'development'), |
/* | |
A valid number can be split up into these components (in order): | |
- A decimal number or an integer. | |
- (Optional) An 'e' or 'E', followed by an integer. | |
=> A decimal number can be split up into these components (in order): | |
-> (Optional) A sign character (either '+' or '-'). | |
-> One of the following formats: |
module.exports = { | |
// Extends the previous ESLint configuration by adding `settings` | |
// <--! Previous configuration comes here !--> | |
settings: { | |
'import/resolver': { | |
typescript: { | |
project: './tsconfig.json', | |
}, | |
}, | |
}, |
module.exports = { | |
// <--! Previous configuration comes here !--> | |
plugins: ['@typescript-eslint', 'prettier', 'import'], // Add "import" plugin | |
extends: [ | |
'eslint:recommended', | |
'plugin:@typescript-eslint/recommended', | |
'plugin:prettier/recommended', | |
// Extends two more configuration from "import" plugin |
module.exports = { | |
// Extends the previous ESLint configuration by adding rules | |
// <--! Previous configuration comes here !--> | |
rules: { | |
'sort-imports': [ | |
'error', | |
{ | |
ignoreCase: false, | |
ignoreDeclarationSort: true, // don"t want to sort import lines, use eslint-plugin-import instead | |
ignoreMemberSort: false, |
module.exports = { | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
ecmaVersion: 2018, | |
sourceType: 'module', | |
}, | |
env: { | |
node: true, | |
}, | |
plugins: ['@typescript-eslint', 'prettier'], |