Skip to content

Instantly share code, notes, and snippets.

@cvindex
Last active July 27, 2016 13:34
Show Gist options
  • Select an option

  • Save cvindex/882a99790dc85439a39241a9636865f7 to your computer and use it in GitHub Desktop.

Select an option

Save cvindex/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