Skip to content

Instantly share code, notes, and snippets.

@frontdevops
Last active July 27, 2016 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frontdevops/882a99790dc85439a39241a9636865f7 to your computer and use it in GitHub Desktop.
Save frontdevops/882a99790dc85439a39241a9636865f7 to your computer and use it in GitHub Desktop.
// Указать тип
const style :ComponentButton = require<ComponentButton>('button.css');
// Если указали тип, то и генерик уже не нужен
const style :ComponentButton = require('button.css');
// Применить typecast
const style = <ComponentButton> require<ComponentButton>('button.css');
// Ну тогда генерик и ненужен
const style = <ComponentButton> require('button.css');
// Другой вариант type assertions (для TSX)
const style = require<ComponentButton>('button.css') as ComponentButton;
// Опять же без генерика ибо и так будут подсказки
const style = require('module.css') as ComponentButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment