ANNOUNCEMENT: We've moved all of these meetups to a better maintained website called Brighton Brains - add it to your bookmarks, share it on your social media, etc. :D
AsyncJS https://asyncjs.com/
A JavaScript meetup for Brighton & Hove
A JavaScript meetup for Brighton & Hove
| const tsconfig = require('./tsconfig.json'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const ASTERISK = /\*/g; | |
| const LEADING_DOT_SLASH = /^\.\//; | |
| const CARET = /\^/g; | |
| const { compilerOptions: { paths } } = tsconfig; |
| /* | |
| Porting Angular modules gradually to CommonJS | |
| CommonJS and Angular modules: https://blog.codecentric.de/en/2014/08/angularjs-browserify/ | |
| */ | |
| /* from */ | |
| angular | |
| .module('react-components', []); |
| // Ref: https://flow.org/en/docs/types/mixed/#toc-anything-goes-in-nothing-comes-out | |
| /** | |
| * Similar to an `any` type, but enforces that you should handle all cases. | |
| */ | |
| type objects = {[i: string]: primitives | objects} | {[i: number]: primitives | objects}; | |
| type primitives = string | number | null | undefined; | |
| type mixed = primitives | objects; |
SOLUTION: Updating ts-jest from 20.0.1 to 20.0.14 fixes the issue
Running my tests with jest - I assume this is an issue with ts-jest / istanbul as it only occurs when collecting coverage.
I have a React, TypeScript component library, and after adding a jsdoc comment I began to get a bunch of errors. e.g.
console.error node_modules/fbjs/lib/warning.js:33
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
| // Tested in version 2.6.1 | |
| type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; | |
| type Same<T extends string, U extends string> = ({ [P in T & U]: P } & { [P in Diff<T, U>]: never } & { [x: string]: never })[T]; | |
| type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }; | |
| type Overwrite<T, U, I = { [P in Diff<keyof T, keyof U>]: T[P] } & U> = Pick<I, keyof I>; | |
| type Only<T, K extends keyof T> = { [P in K]: T[P] }; | |
| type Combine<T, U, I = T | U, R = { [P in Diff<keyof T, keyof I>]: T[P] } & { [P in Same<keyof T, keyof I>]: T[P] | I[P] }> = Pick<R, keyof R>; | |
| type Item1 = { a: string; b: number; c: boolean }; |
| # Paste this into your .bash_profile | |
| function notify-me-on () { | |
| if [ -z "$1" ] | |
| then | |
| echo "No arguments supplied" | |
| echo "Usage: command | notify-me-on <match> <message>" | |
| exit 1; | |
| fi |
| // Info about available characters | |
| // https://mathiasbynens.be/notes/javascript-identifiers | |
| // Test your variable names | |
| // https://mothereff.in/js-variables | |
| const ǀʋ〇ᴥ〇ǀ = 'Jake the dog'; // Needs parenthesis-like wrapper | |
| const ᗡo_oᗞ = 'Monkey or Deadmau5?'; | |
| const シ = 'Smile'; | |
| const ㇱ = 'Small smile'; |
| const MATCHES_AN = /(^|\s)a(?:(\s+[aeiuo])|(n)(\s+[^aeiou]))/gi; | |
| const sentence1 = 'This is an string with a unnoticed mistake in it.'; | |
| const sentence2 = 'This is a string with an unnoticed mistake in it.'; | |
| function aAn (match, boundary, vowel, n, consonant) { | |
| return `${boundary}a${n ? '' : 'n'}${vowel || consonant}`; | |
| } | |
| const result1 = sentence1.replace(MATCHES_AN, aAn); |
| interface PartialArray<T> { | |
| /** | |
| * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. | |
| */ | |
| length: number; | |
| /** | |
| * Returns a string representation of an array. | |
| */ | |
| toString(): string; | |
| toLocaleString(): string; |